From 8663ea61e40e7e33ad17d757c358e7719d4b2c47 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Tue, 2 Sep 2025 22:02:11 -0400 Subject: [PATCH] Invoke workflow-backed op in two-stage style --- hello_nexus/caller/workflows.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hello_nexus/caller/workflows.py b/hello_nexus/caller/workflows.py index 240b8b8c..2016f99f 100644 --- a/hello_nexus/caller/workflows.py +++ b/hello_nexus/caller/workflows.py @@ -21,15 +21,15 @@ def __init__(self): @workflow.run async def run(self, name: str) -> tuple[MyOutput, MyOutput]: # Start the nexus operation and wait for the result in one go, using execute_operation. - wf_result = await self.nexus_client.execute_operation( - MyNexusService.my_workflow_run_operation, + op_1_result = await self.nexus_client.execute_operation( + MyNexusService.my_sync_operation, MyInput(name), ) # Alternatively, you can use start_operation to obtain the operation handle and # then `await` the handle to obtain the result. - sync_operation_handle = await self.nexus_client.start_operation( - MyNexusService.my_sync_operation, + op_2_handle = await self.nexus_client.start_operation( + MyNexusService.my_workflow_run_operation, MyInput(name), ) - sync_result = await sync_operation_handle - return sync_result, wf_result + op_2_result = await op_2_handle + return op_1_result, op_2_result