Skip to content

Commit 2413a16

Browse files
committed
Make it non-async def
1 parent 2fd1407 commit 2413a16

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

hello/hello_standalone_activity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
from concurrent.futures import ThreadPoolExecutor
23
from dataclasses import dataclass
34
from 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)

0 commit comments

Comments
 (0)