You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, workflow cancellation does not result in cancellation of in-progress signal/update handler executions.
For example, consider the case of update and see the sample below: the client waiting on the update gets an exception, but the exception is workflow execution already completed. This ticket calls for that exception to inform the client that the update was canceled due to cancellation of the workflow.
Doing this for signal handlers would be backwards-incompatible and hence will need to use an SDK workflow logic flag.
@workflow.defnclassUpdateCancellationWorkflow:
def__init__(self) ->None:
self.non_terminating_operation_has_started=False@workflow.runasyncdefrun(self) ->str:
awaitworkflow.wait_condition(lambda: False)
return"unreachable"@workflow.updateasyncdefwait_until_non_terminating_operation_has_started(self) ->None:
awaitworkflow.wait_condition(
lambda: self.non_terminating_operation_has_started
)
@workflow.updateasyncdefnon_terminating_operation(self) ->str:
self.non_terminating_operation_has_started=Trueawaitworkflow.wait_condition(lambda: False)
return"unreachable"asyncdeftest_update_cancellation(client: Client):
asyncwithnew_worker(client, UpdateCancellationWorkflow) asworker:
wf_handle=awaitclient.start_workflow(
UpdateCancellationWorkflow.run,
id=str(uuid.uuid4()),
task_queue=worker.task_queue,
)
# Asynchronously run an update that will never completenon_terminating_update_task=asyncio.create_task(
wf_handle.execute_update(
UpdateCancellationWorkflow.non_terminating_operation
)
)
print("wait until handler started...")
# Wait until we know the update handler has started executingawaitwf_handle.execute_update(
UpdateCancellationWorkflow.wait_until_non_terminating_operation_has_started
)
print("cancel the workflow")
awaitwf_handle.cancel()
print("await non_terminating_update_task...")
awaitnon_terminating_update_task
The text was updated successfully, but these errors were encountered:
Currently, workflow cancellation does not result in cancellation of in-progress signal/update handler executions.
For example, consider the case of update and see the sample below: the client waiting on the update gets an exception, but the exception is
workflow execution already completed
. This ticket calls for that exception to inform the client that the update was canceled due to cancellation of the workflow.Doing this for signal handlers would be backwards-incompatible and hence will need to use an SDK workflow logic flag.
The text was updated successfully, but these errors were encountered: