Skip to content

Commit 9019690

Browse files
committed
Use helper for update-with-start
1 parent 4281b20 commit 9019690

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

temporalio/client.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,24 +1078,16 @@ async def _start_update_with_start(
10781078
raise RuntimeError("WithStartWorkflowOperation cannot be reused")
10791079
start_workflow_operation._used = True
10801080

1081-
update_name: str
1082-
ret_type = result_type
1083-
if isinstance(update, temporalio.workflow.UpdateMethodMultiParam):
1084-
defn = update._defn
1085-
if not defn.name:
1086-
raise RuntimeError("Cannot invoke dynamic update definition")
1087-
# TODO(cretz): Check count/type of args at runtime?
1088-
update_name = defn.name
1089-
ret_type = defn.ret_type
1090-
else:
1091-
update_name = str(update)
1081+
update_name, result_type_from_type_hint = (
1082+
temporalio.workflow._UpdateDefinition.get_name_and_result_type(update)
1083+
)
10921084

10931085
update_input = UpdateWithStartUpdateWorkflowInput(
10941086
update_id=id,
10951087
update=update_name,
10961088
args=temporalio.common._arg_or_args(arg, args),
10971089
headers={},
1098-
ret_type=ret_type,
1090+
ret_type=result_type or result_type_from_type_hint,
10991091
rpc_metadata=rpc_metadata,
11001092
rpc_timeout=rpc_timeout,
11011093
wait_for_stage=wait_for_stage,

0 commit comments

Comments
 (0)