Make scheduled tasks configurable via worker.configure_scheduled_tasks()#163
Merged
berndverst merged 2 commits intoJun 29, 2026
Conversation
Replace the free function configure_scheduled_tasks(worker) with a TaskHubGrpcWorker.configure_scheduled_tasks() method and remove the registration module. The feature is unreleased, so this is a clean breaking change to a single canonical pattern consistent with add_orchestrator/add_entity.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the scheduled-tasks worker setup API by moving configuration from a free function (durabletask.scheduled.configure_scheduled_tasks(worker)) to a first-class method on TaskHubGrpcWorker (worker.configure_scheduled_tasks()), aligning it with the existing worker registration patterns.
Changes:
- Added
TaskHubGrpcWorker.configure_scheduled_tasks()(lazy-importing scheduled components to avoid circular imports). - Removed
durabletask/scheduled/registration.pyand stopped exportingconfigure_scheduled_tasksfromdurabletask.scheduled. - Updated examples, tests (core + azuremanaged), and changelog to use the method-based configuration.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
durabletask/worker.py |
Introduces configure_scheduled_tasks() on the worker and updates capability-related docs/comments accordingly. |
durabletask/scheduled/__init__.py |
Updates package docstring and removes the configure_scheduled_tasks export. |
durabletask/scheduled/registration.py |
Removes the legacy free-function registration module. |
examples/scheduled_tasks.py |
Updates the scheduled tasks example to use worker.configure_scheduled_tasks(). |
tests/durabletask/scheduled/test_scheduled_e2e.py |
Updates core scheduled e2e test to use the new worker method. |
tests/durabletask/scheduled/test_client_filter_and_capability.py |
Updates capability advertisement test to call the new worker method. |
tests/durabletask-azuremanaged/scheduled/test_dts_scheduled_e2e.py |
Updates azuremanaged scheduled e2e test to use the inherited worker method. |
CHANGELOG.md |
Updates Unreleased entry to reflect the method-based configuration. |
berndverst
approved these changes
Jun 29, 2026
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.
Summary
Replaces the free function
configure_scheduled_tasks(worker)with aTaskHubGrpcWorker.configure_scheduled_tasks()method, for consistency with the existing worker registration API (add_orchestrator,add_entity,add_capability,use_versioning).The scheduled tasks feature is still unreleased (
## Unreleasedin the changelog), so this is a clean breaking change to a single canonical pattern rather than a deprecation.Changes
TaskHubGrpcWorker.configure_scheduled_tasks(). It lazily imports the schedule entity/orchestrator to avoid a circular import (durabletask.scheduledimports fromdurabletask.worker).durabletask/scheduled/registration.pymodule and itsconfigure_scheduled_tasksexport fromdurabletask.scheduled.The azuremanaged
DurableTaskSchedulerWorkerinherits the method automatically, so no provider code changes were needed.Testing
flake8clean on changed core files.dts-marked azuremanaged e2e requires the emulator and was not run locally.)