@@ -3979,7 +3979,6 @@ def workflow_run_id(self) -> Optional[str]:
3979
3979
async def result (
3980
3980
self ,
3981
3981
* ,
3982
- timeout : Optional [timedelta ] = None ,
3983
3982
rpc_metadata : Mapping [str , str ] = {},
3984
3983
rpc_timeout : Optional [timedelta ] = None ,
3985
3984
) -> LocalReturnType :
@@ -3988,7 +3987,6 @@ async def result(
3988
3987
specified.
3989
3988
3990
3989
Args:
3991
- timeout: Optional timeout specifying maximum wait time for the result.
3992
3990
rpc_metadata: Headers used on the RPC call. Keys here override client-level RPC metadata keys.
3993
3991
rpc_timeout: Optional RPC deadline to set for the RPC call. If this elapses, the poll is retried until the
3994
3992
overall timeout has been reached.
@@ -4007,18 +4005,43 @@ async def result(
4007
4005
self ._result_type ,
4008
4006
)
4009
4007
4010
- return await self ._client ._impl .poll_workflow_update (
4011
- PollWorkflowUpdateInput (
4012
- self .workflow_id ,
4013
- self .workflow_run_id ,
4014
- self .id ,
4015
- timeout ,
4016
- self ._result_type ,
4017
- rpc_metadata ,
4018
- rpc_timeout ,
4019
- )
4008
+ req = temporalio .api .workflowservice .v1 .PollWorkflowExecutionUpdateRequest (
4009
+ namespace = self ._client .namespace ,
4010
+ update_ref = temporalio .api .update .v1 .UpdateRef (
4011
+ workflow_execution = temporalio .api .common .v1 .WorkflowExecution (
4012
+ workflow_id = self .workflow_id ,
4013
+ run_id = self .workflow_run_id or "" ,
4014
+ ),
4015
+ update_id = self .id ,
4016
+ ),
4017
+ identity = self ._client .identity ,
4018
+ wait_policy = temporalio .api .update .v1 .WaitPolicy (
4019
+ lifecycle_stage = temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage .UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED
4020
+ ),
4020
4021
)
4021
4022
4023
+ # Continue polling as long as we have either an empty response, or an *rpc* timeout
4024
+ while True :
4025
+ try :
4026
+ res = (
4027
+ await self ._client .workflow_service .poll_workflow_execution_update (
4028
+ req ,
4029
+ retry = True ,
4030
+ metadata = rpc_metadata ,
4031
+ timeout = rpc_timeout ,
4032
+ )
4033
+ )
4034
+ if res .HasField ("outcome" ):
4035
+ return await _update_outcome_to_result (
4036
+ res .outcome ,
4037
+ self .id ,
4038
+ self ._client .data_converter ,
4039
+ self ._result_type ,
4040
+ )
4041
+ except RPCError as err :
4042
+ if err .status != RPCStatusCode .DEADLINE_EXCEEDED :
4043
+ raise
4044
+
4022
4045
4023
4046
class WorkflowFailureError (temporalio .exceptions .TemporalError ):
4024
4047
"""Error that occurs when a workflow is unsuccessful."""
@@ -4241,19 +4264,6 @@ class StartWorkflowUpdateInput:
4241
4264
rpc_timeout : Optional [timedelta ]
4242
4265
4243
4266
4244
- @dataclass
4245
- class PollWorkflowUpdateInput :
4246
- """Input for :py:meth:`OutboundInterceptor.poll_workflow_update`."""
4247
-
4248
- workflow_id : str
4249
- run_id : Optional [str ]
4250
- update_id : str
4251
- timeout : Optional [timedelta ]
4252
- ret_type : Optional [Type ]
4253
- rpc_metadata : Mapping [str , str ]
4254
- rpc_timeout : Optional [timedelta ]
4255
-
4256
-
4257
4267
@dataclass
4258
4268
class HeartbeatAsyncActivityInput :
4259
4269
"""Input for :py:meth:`OutboundInterceptor.heartbeat_async_activity`."""
@@ -4504,10 +4514,6 @@ async def start_workflow_update(
4504
4514
"""Called for every :py:meth:`WorkflowHandle.update` and :py:meth:`WorkflowHandle.start_update` call."""
4505
4515
return await self .next .start_workflow_update (input )
4506
4516
4507
- async def poll_workflow_update (self , input : PollWorkflowUpdateInput ) -> Any :
4508
- """May be called when calling :py:meth:`WorkflowUpdateHandle.result`."""
4509
- return await self .next .poll_workflow_update (input )
4510
-
4511
4517
### Async activity calls
4512
4518
4513
4519
async def heartbeat_async_activity (
@@ -4885,48 +4891,6 @@ async def start_workflow_update(
4885
4891
4886
4892
return update_handle
4887
4893
4888
- async def poll_workflow_update (self , input : PollWorkflowUpdateInput ) -> Any :
4889
- req = temporalio .api .workflowservice .v1 .PollWorkflowExecutionUpdateRequest (
4890
- namespace = self ._client .namespace ,
4891
- update_ref = temporalio .api .update .v1 .UpdateRef (
4892
- workflow_execution = temporalio .api .common .v1 .WorkflowExecution (
4893
- workflow_id = input .workflow_id ,
4894
- run_id = input .run_id or "" ,
4895
- ),
4896
- update_id = input .update_id ,
4897
- ),
4898
- identity = self ._client .identity ,
4899
- wait_policy = temporalio .api .update .v1 .WaitPolicy (
4900
- lifecycle_stage = temporalio .api .enums .v1 .UpdateWorkflowExecutionLifecycleStage .UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED
4901
- ),
4902
- )
4903
-
4904
- async def poll_loop ():
4905
- # Continue polling as long as we have either an empty response, or an *rpc* timeout
4906
- while True :
4907
- try :
4908
- res = await self ._client .workflow_service .poll_workflow_execution_update (
4909
- req ,
4910
- retry = True ,
4911
- metadata = input .rpc_metadata ,
4912
- timeout = input .rpc_timeout ,
4913
- )
4914
- if res .HasField ("outcome" ):
4915
- return await _update_outcome_to_result (
4916
- res .outcome ,
4917
- input .update_id ,
4918
- self ._client .data_converter ,
4919
- input .ret_type ,
4920
- )
4921
- except RPCError as err :
4922
- if err .status != RPCStatusCode .DEADLINE_EXCEEDED :
4923
- raise
4924
-
4925
- # Wait for at most the *overall* timeout
4926
- return await asyncio .wait_for (
4927
- poll_loop (), input .timeout .total_seconds () if input .timeout else None
4928
- )
4929
-
4930
4894
### Async activity calls
4931
4895
4932
4896
async def heartbeat_async_activity (
0 commit comments