2525 _start_nexus_backing_workflow ,
2626 _TemporalStartOperationContext ,
2727)
28- from temporalio .nexus ._token import UpdateHandle
2928from temporalio .types import (
3029 MethodAsyncNoParam ,
3130 MethodAsyncSingleParam ,
3534 SelfType ,
3635)
3736
37+ from ._token import OperationToken , OperationTokenType
38+
3839if TYPE_CHECKING :
3940 import temporalio .client
4041 import temporalio .workflow
@@ -289,9 +290,11 @@ async def start_workflow_update(
289290 workflow_id : str ,
290291 update : temporalio .workflow .UpdateMethodMultiParam [[Any ], ReturnType ],
291292 * ,
292- id : str | None = None ,
293+ update_id : str | None = None ,
293294 rpc_metadata : Mapping [str , str | bytes ] = {},
294295 rpc_timeout : timedelta | None = None ,
296+ run_id : str | None = None ,
297+ first_execution_run_id : str | None = None ,
295298 ) -> TemporalOperationResult [ReturnType ]: ...
296299
297300 # Overload for single-param update
@@ -304,9 +307,11 @@ async def start_workflow_update(
304307 ],
305308 arg : ParamType ,
306309 * ,
307- id : str | None = None ,
310+ update_id : str | None = None ,
308311 rpc_metadata : Mapping [str , str | bytes ] = {},
309312 rpc_timeout : timedelta | None = None ,
313+ run_id : str | None = None ,
314+ first_execution_run_id : str | None = None ,
310315 ) -> TemporalOperationResult [ReturnType ]: ...
311316
312317 # Overload for multi-param update
@@ -317,9 +322,11 @@ async def start_workflow_update(
317322 update : temporalio .workflow .UpdateMethodMultiParam [MultiParamSpec , ReturnType ],
318323 * ,
319324 args : MultiParamSpec .args , # type: ignore
320- id : str | None = None ,
325+ update_id : str | None = None ,
321326 rpc_metadata : Mapping [str , str | bytes ] = {},
322327 rpc_timeout : timedelta | None = None ,
328+ run_id : str | None = None ,
329+ first_execution_run_id : str | None = None ,
323330 ) -> TemporalOperationResult [ReturnType ]: ...
324331
325332 # Overload for string-name update
@@ -331,14 +338,14 @@ async def start_workflow_update(
331338 arg : Any = temporalio .common ._arg_unset ,
332339 * ,
333340 args : Sequence [Any ] = [],
334- id : str | None = None ,
341+ update_id : str | None = None ,
335342 result_type : type [ReturnType ] | None = None ,
336343 rpc_metadata : Mapping [str , str | bytes ] = {},
337344 rpc_timeout : timedelta | None = None ,
345+ run_id : str | None = None ,
346+ first_execution_run_id : str | None = None ,
338347 ) -> TemporalOperationResult [ReturnType ]: ...
339348
340- # draft-review: check why run_id and first_execution_run_id are not used
341- # for update workflow in python sdk
342349 @abstractmethod
343350 async def start_workflow_update (
344351 self ,
@@ -347,7 +354,7 @@ async def start_workflow_update(
347354 arg : Any = temporalio .common ._arg_unset ,
348355 * ,
349356 args : Sequence [Any ] = [],
350- id : str | None = None ,
357+ update_id : str | None = None ,
351358 result_type : type | None = None ,
352359 rpc_metadata : Mapping [str , str | bytes ] = {},
353360 rpc_timeout : timedelta | None = None ,
@@ -467,7 +474,7 @@ async def start_workflow_update(
467474 arg : Any = temporalio .common ._arg_unset ,
468475 * ,
469476 args : Sequence [Any ] = [],
470- id : str | None = None ,
477+ update_id : str | None = None ,
471478 result_type : type | None = None ,
472479 rpc_metadata : Mapping [str , str | bytes ] = {},
473480 rpc_timeout : timedelta | None = None ,
@@ -487,15 +494,14 @@ async def start_workflow_update(
487494 update = update ,
488495 arg = arg ,
489496 args = args ,
490- id = id ,
497+ update_id = update_id ,
491498 result_type = result_type ,
492499 rpc_metadata = rpc_metadata ,
493500 rpc_timeout = rpc_timeout ,
494501 run_id = run_id ,
495502 first_execution_run_id = first_execution_run_id ,
496503 )
497504 # If the update has already completed, return the result synchronously
498- # This is in-line with the Go implementation as well
499505 if update_handle ._known_outcome is not None :
500506 try :
501507 result = await update_handle .result ()
@@ -504,7 +510,11 @@ async def start_workflow_update(
504510 str (err ), state = OperationErrorState .FAILED
505511 ) from err
506512 return TemporalOperationResult .sync (result )
507- nexus_handle : UpdateHandle [Any ] = (
508- UpdateHandle ._unsafe_from_client_workflow_update_handle (update_handle )
509- )
510- return TemporalOperationResult .async_token (nexus_handle .to_token ())
513+ token = OperationToken (
514+ type = OperationTokenType .UPDATE_WORKFLOW ,
515+ namespace = update_handle ._client .namespace ,
516+ workflow_id = update_handle .workflow_id ,
517+ update_id = update_handle .id ,
518+ run_id = update_handle .workflow_run_id ,
519+ ).encode ()
520+ return TemporalOperationResult .async_token (token )
0 commit comments