@@ -990,11 +990,6 @@ async def _start_update_with_start(
990990 wait_for_stage = wait_for_stage ,
991991 )
992992
993- input = StartWorkflowUpdateWithStartInput (
994- start_workflow_input = start_workflow_operation ._start_workflow_input ,
995- update_workflow_input = update_input ,
996- )
997-
998993 def on_start (
999994 start_response : temporalio .api .workflowservice .v1 .StartWorkflowExecutionResponse ,
1000995 ):
@@ -1006,7 +1001,11 @@ def on_start(
10061001 )
10071002 )
10081003
1009- setattr (input , "_on_start_callback" , on_start )
1004+ input = StartWorkflowUpdateWithStartInput (
1005+ start_workflow_input = start_workflow_operation ._start_workflow_input ,
1006+ update_workflow_input = update_input ,
1007+ _on_start_callback = on_start ,
1008+ )
10101009
10111010 update_handle = await self ._impl .start_workflow_update_with_start (input )
10121011 # TODO https://github.com/temporalio/sdk-python/issues/682
@@ -5134,6 +5133,9 @@ class StartWorkflowUpdateWithStartInput:
51345133
51355134 start_workflow_input : UpdateWithStartStartWorkflowInput
51365135 update_workflow_input : UpdateWithStartUpdateWorkflowInput
5136+ _on_start_callback : Callable [
5137+ [temporalio .api .workflowservice .v1 .StartWorkflowExecutionResponse ], None
5138+ ]
51375139
51385140
51395141@dataclass
@@ -5891,16 +5893,10 @@ async def start_workflow_update_with_start(
58915893 ],
58925894 )
58935895
5894- on_start = getattr (input , "_on_start_callback" , None )
5895- if not on_start :
5896- raise RuntimeError (
5897- "Missing on_start callback. Please report this as a bug at https://github.com/temporalio/sdk-python/issues."
5898- )
5899- seen_start = False
5900-
59015896 # Repeatedly try to invoke ExecuteMultiOperation until the update
59025897 # reaches user-provided wait stage or is at least ACCEPTED (as of the
59035898 # time of this writing, the user cannot specify sooner than ACCEPTED)
5899+ seen_start = False
59045900 while True :
59055901 try :
59065902 multiop_response = (
@@ -5964,7 +5960,7 @@ async def start_workflow_update_with_start(
59645960 [start_response ] = start_responses
59655961 [update_response ] = update_responses
59665962 if not seen_start :
5967- on_start (start_response )
5963+ input . _on_start_callback (start_response )
59685964 seen_start = True
59695965 known_outcome = (
59705966 update_response .outcome if update_response .HasField ("outcome" ) else None
0 commit comments