temporalio / sdk-python

Temporal Python SDK
MIT License
473 stars 77 forks source link

Make update caller receive update failed error on workflow cancellation #653

Open dandavison opened 2 months ago

dandavison commented 2 months ago

Fixes #575

Today, if a workflow terminates via cancellation with an in-progress update, the update caller sees a gRPC NOT FOUND error (because the server aborts the update after the workflow is closed).

This PR causes the caller to see WorkflowUpdateFailedError, which is what the caller sees in this situation with all other Temporal SDKs.

It does so by cancelling the asyncio Task representing the update handler execution; the resulting exception in the update handler coroutine causes the update to fail.

How this was tested