Allow passing custom stub to execute operations#85
Merged
andystaples merged 7 commits intomainfrom Dec 12, 2025
Merged
Conversation
andystaples
commented
Dec 5, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces support for passing custom stub implementations to worker execution methods, enabling Azure Functions to inject custom behavior where a real sidecar stub is unavailable. The key change is the addition of a ProtoTaskHubSidecarServiceStub interface class that can be used as an alternative to the gRPC-generated TaskHubSidecarServiceStub.
- Defines a new
ProtoTaskHubSidecarServiceStubclass as a protocol for custom stub implementations - Updates six worker methods to accept either the gRPC stub or the custom stub via Union type annotations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| durabletask/internal/proto_task_hub_sidecar_service_stub.py | Introduces new stub interface class with callable attributes for all TaskHubSidecarService methods |
| durabletask/worker.py | Updates type annotations for stub parameters in _execute_orchestrator, _cancel_orchestrator, _execute_activity, _cancel_activity, _execute_entity_batch, and _cancel_entity_batch methods to accept custom stub |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
berndverst
approved these changes
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow passing a custom stub (some implementation of the newly-defined ProtoTaskHubSidecarServiceStub) to the method call operations in the worker.
This is needed for the Azure Functions module, as the protobuf stub will not be available during worker operations - we need to be able to define and pass a custom stub with behavior to capture the inputs to the stub methods used in these methods to redirect back through the Python worker to the functions host indirectly.