Skip to content

Make scheduled tasks configurable via worker.configure_scheduled_tasks()#163

Merged
berndverst merged 2 commits into
microsoft:mainfrom
andystaples:andystaples/scheduled-tasks-config-consistency
Jun 29, 2026
Merged

Make scheduled tasks configurable via worker.configure_scheduled_tasks()#163
berndverst merged 2 commits into
microsoft:mainfrom
andystaples:andystaples/scheduled-tasks-config-consistency

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Summary

Replaces the free function configure_scheduled_tasks(worker) with a TaskHubGrpcWorker.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 (## Unreleased in the changelog), so this is a clean breaking change to a single canonical pattern rather than a deprecation.

Changes

  • Added TaskHubGrpcWorker.configure_scheduled_tasks(). It lazily imports the schedule entity/orchestrator to avoid a circular import (durabletask.scheduled imports from durabletask.worker).
  • Removed the now-redundant durabletask/scheduled/registration.py module and its configure_scheduled_tasks export from durabletask.scheduled.
  • Updated the example, unit/e2e tests, docstrings, and changelog to the method form.

The azuremanaged DurableTaskSchedulerWorker inherits the method automatically, so no provider code changes were needed.

Testing

  • flake8 clean on changed core files.
  • Affected scheduled unit and in-memory e2e tests pass. (The dts-marked azuremanaged e2e requires the emulator and was not run locally.)

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.
Copilot AI review requested due to automatic review settings June 29, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.py and stopped exporting configure_scheduled_tasks from durabletask.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.

Comment thread durabletask/worker.py
Comment thread durabletask/worker.py Outdated
Comment thread durabletask/worker.py
@berndverst berndverst merged commit f2a6ec8 into microsoft:main Jun 29, 2026
17 checks passed
@andystaples andystaples deleted the andystaples/scheduled-tasks-config-consistency branch June 29, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants