-
Notifications
You must be signed in to change notification settings - Fork 19
Abandon workitems #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
….com/microsoft/durabletask-python into andystaples/abandon-failed-workitems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces cancellation functionality to the async worker manager system, enabling graceful handling of failed work items and proper cleanup during shutdowns.
Key Changes:
- Adds cancel methods (
_cancel_orchestrator,_cancel_activity,_cancel_entity_batch) that invoke appropriate abandon operations when work items cannot be completed - Updates all submit methods to accept cancellation functions alongside execution functions
- Implements error handling in the
run()method to cancel pending work items when the worker manager encounters exceptions
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| durabletask/worker.py | Adds cancellation methods, updates submit signatures to accept cancel functions, adds error handling for queue exceptions, and implements cancellation during reset operations |
| tests/durabletask/test_worker_concurrency_loop_async.py | Updates test to provide cancel function stubs when submitting work items to match the new API |
| tests/durabletask/test_worker_concurrency_loop.py | Updates test to provide cancel function stubs when submitting work items to match the new API |
Comments suppressed due to low confidence (3)
tests/durabletask/test_worker_concurrency_loop.py:131
- Call to method _AsyncWorkerManager.submit_orchestration with too few arguments; should be no fewer than 2.
manager.submit_orchestration(make_work("orch", i))
tests/durabletask/test_worker_concurrency_loop.py:132
- Call to method _AsyncWorkerManager.submit_activity with too few arguments; should be no fewer than 2.
manager.submit_activity(make_work("act", i))
durabletask/worker.py:2228
- 'except' clause does nothing but pass and there is no explanatory comment.
except Exception:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In certain cases, when a workitem fails in the SDK due to an internal error, or a worker shutdown, we need to send an abandon message to the backend to let it know that the items need to be re-sent for processing - without this, they may become stuck.
Adds support for abandoning workitems in these cases.