88import inspect
99import json
1010import re
11+ import sys
1112import uuid
1213import warnings
1314from abc import ABC , abstractmethod
@@ -1668,7 +1669,7 @@ async def start_update(
16681669 * ,
16691670 args : Sequence [Any ] = [],
16701671 id : Optional [str ] = None ,
1671- wait_for_stage : temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage = temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage .UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED ,
1672+ wait_for_stage : temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage . ValueType = temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage .UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED ,
16721673 result_type : Optional [Type ] = None ,
16731674 rpc_metadata : Mapping [str , str ] = {},
16741675 rpc_timeout : Optional [timedelta ] = None ,
@@ -2815,8 +2816,8 @@ class ScheduleActionStartWorkflow(ScheduleAction):
28152816
28162817 @staticmethod
28172818 def _from_proto (
2818- info : temporalio .api .workflow .v1 .NewWorkflowExecutionInfo ,
2819- ) -> ScheduleActionStartWorkflow : # type: ignore[override]
2819+ info : temporalio .api .workflow .v1 .NewWorkflowExecutionInfo , # type: ignore[override]
2820+ ) -> ScheduleActionStartWorkflow :
28202821 return ScheduleActionStartWorkflow ("<unset>" , raw_info = info )
28212822
28222823 # Overload for no-param workflow
@@ -3797,13 +3798,18 @@ def __init__(
37973798 run_id : Optional [str ] = None ,
37983799 result_type : Optional [Type ] = None ,
37993800 ):
3801+ """Create a workflow update handle.
3802+
3803+ Users should not create this directly, but rather use
3804+ :py:meth:`Client.start_workflow_update`.
3805+ """
38003806 self ._client = client
38013807 self ._id = id
38023808 self ._name = name
38033809 self ._workflow_id = workflow_id
38043810 self ._run_id = run_id
38053811 self ._result_type = result_type
3806- self ._known_result = None
3812+ self ._known_result : Optional [ temporalio . api . update . v1 . Outcome ] = None
38073813
38083814 @property
38093815 def id (self ) -> str :
@@ -3829,7 +3835,7 @@ async def result(
38293835 self ,
38303836 * ,
38313837 timeout : Optional [timedelta ] = None ,
3832- rpc_metadata : Mapping [str , str ] = None ,
3838+ rpc_metadata : Mapping [str , str ] = {} ,
38333839 rpc_timeout : Optional [timedelta ] = None ,
38343840 ) -> Any :
38353841 """Wait for and return the result of the update. The result may already be known in which case no call is made.
@@ -4084,7 +4090,7 @@ class UpdateWorkflowInput:
40844090 update : str
40854091 args : Sequence [Any ]
40864092 wait_for_stage : Optional [
4087- temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage
4093+ temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage . ValueType
40884094 ]
40894095 headers : Mapping [str , temporalio .api .common .v1 .Payload ]
40904096 ret_type : Optional [Type ]
@@ -4724,9 +4730,7 @@ async def start_workflow_update(
47244730 # If the status is INVALID_ARGUMENT, we can assume it's an update
47254731 # failed error
47264732 if err .status == RPCStatusCode .INVALID_ARGUMENT :
4727- raise WorkflowUpdateFailedError (
4728- input .workflow_id , input .update , err .cause
4729- )
4733+ raise WorkflowUpdateFailedError (input .workflow_id , input .update , err )
47304734 else :
47314735 raise
47324736
@@ -4760,7 +4764,9 @@ async def poll_workflow_update(self, input: PollUpdateWorkflowInput) -> Any:
47604764 )
47614765 try :
47624766 # Wait for at most the *overall* timeout
4763- async with asyncio .timeout (input .timeout .total_seconds ()):
4767+ async with asyncio .timeout (
4768+ input .timeout .total_seconds () if input .timeout else sys .float_info .max
4769+ ):
47644770 # Continue polling as long as we have either an empty response, or an *rpc* timeout
47654771 while True :
47664772 try :
0 commit comments