Skip to content

Commit

Permalink
Simplify MultiOp response handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Dec 18, 2024
1 parent 7beb8cb commit 3c17209
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions temporalio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
FrozenSet,
Generic,
Iterable,
List,
Mapping,
Optional,
Sequence,
Expand Down Expand Up @@ -6122,24 +6121,8 @@ async def _start_workflow_update_with_start(
multiop_response = (
await self._client.workflow_service.execute_multi_operation(multiop_req)
)
start_responses: List[
temporalio.api.workflowservice.v1.StartWorkflowExecutionResponse
] = [
r.start_workflow
for r in multiop_response.responses
if r.HasField("start_workflow")
]
update_responses: List[
temporalio.api.workflowservice.v1.UpdateWorkflowExecutionResponse
] = [
r.update_workflow
for r in multiop_response.responses
if r.HasField("update_workflow")
]
if not (len(start_responses) == 1 and len(update_responses) == 1):
raise RuntimeError("Invalid ExecuteMultiOperationResponse")
[start_response] = start_responses
[update_response] = update_responses
start_response = multiop_response.responses[0].start_workflow
update_response = multiop_response.responses[1].update_workflow
on_start(start_response)
known_outcome = (
update_response.outcome if update_response.HasField("outcome") else None
Expand Down

0 comments on commit 3c17209

Please sign in to comment.