File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import asyncio
2+ from concurrent .futures import ThreadPoolExecutor
23from dataclasses import dataclass
34from datetime import timedelta
45
@@ -21,7 +22,7 @@ class ComposeGreetingInput:
2122# This is just a normal activity. You could invoke it from a workflow but, in this sample, we are
2223# invoking it directly as a standalone activity.
2324@activity .defn
24- async def compose_greeting (input : ComposeGreetingInput ) -> str :
25+ def compose_greeting (input : ComposeGreetingInput ) -> str :
2526 activity .logger .info ("Running activity with parameter %s" % input )
2627 return f"{ input .greeting } , { input .name } !"
2728
@@ -68,6 +69,7 @@ async def main():
6869 client ,
6970 task_queue = "hello-standalone-activity-task-queue" ,
7071 activities = [compose_greeting ],
72+ activity_executor = ThreadPoolExecutor (5 ),
7173 ):
7274 # While the worker is running, use the client to execute the activity.
7375 await my_client_code (client )
You can’t perform that action at this time.
0 commit comments