Skip to content

Commit 20722ef

Browse files
committed
Don't print in workflow
1 parent 78b2f52 commit 20722ef

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

nexus_sync_operations/caller/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ async def execute_caller_workflow(
2424
task_queue=TASK_QUEUE,
2525
workflows=[CallerWorkflow],
2626
):
27-
await client.execute_workflow(
27+
log = await client.execute_workflow(
2828
CallerWorkflow.run,
2929
id=str(uuid.uuid4()),
3030
task_queue=TASK_QUEUE,
3131
)
32+
for line in log:
33+
print(line)
3234

3335

3436
if __name__ == "__main__":

nexus_sync_operations/caller/workflows.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
@workflow.defn
1818
class CallerWorkflow:
1919
@workflow.run
20-
async def run(self) -> None:
20+
async def run(self) -> list[str]:
21+
log = []
2122
nexus_client = workflow.create_nexus_client(
2223
service=GreetingService,
2324
endpoint=NEXUS_ENDPOINT,
@@ -27,7 +28,7 @@ async def run(self) -> None:
2728
supported_languages = await nexus_client.execute_operation(
2829
GreetingService.get_languages, GetLanguagesInput(include_unsupported=False)
2930
)
30-
print(f"supported languages: {supported_languages}")
31+
log.append(f"supported languages: {supported_languages}")
3132

3233
# Set language
3334
previous_language = await nexus_client.execute_operation(
@@ -38,4 +39,8 @@ async def run(self) -> None:
3839
await nexus_client.execute_operation(GreetingService.get_language, None)
3940
== Language.ARABIC
4041
)
41-
print(f"language changed: {previous_language.name} -> {Language.ARABIC.name}")
42+
log.append(
43+
f"language changed: {previous_language.name} -> {Language.ARABIC.name}"
44+
)
45+
46+
return log

0 commit comments

Comments
 (0)