Skip to content

xtr_scheduler.bundle

The xtr-dependency-injection bundle for xtr-scheduler.

SCHEDULER_POOL module-attribute

SCHEDULER_POOL: Final = 'scheduler'

The cache pool added for schedules' saved state, when the cache bundle is active.

SchedulerBundle

SchedulerBundle()

Bases: Bundle[SchedulerConfig]

Wires declared schedules and tasks to the container and to messenger workers.

Start with nothing declared.

prepend_extension

prepend_extension(builder: ContainerBuilder) -> None

When the cache bundle is active, add a scheduler pool to its config.

Nothing uses it on its own: a schedule provider asks for it — Annotated[CacheInterface, Target("scheduler")] — and hands it to :meth:Schedule.stateful <xtr_scheduler.schedule.Schedule.stateful>.

build

build(builder: ContainerBuilder) -> None

Collect declared schedules and tasks; register the pass that makes them consumable.

A task declared for other environments (env=) is left out, the way @when leaves out a service — but its schedule stays, empty if nothing else is on it, so a worker can be started for it anywhere.

load_extension

load_extension(config: SchedulerConfig, services: ServiceConfigurator, builder: ContainerBuilder) -> None

Register the locators, and what the active peers can use them for.

SchedulerConfig dataclass

SchedulerConfig(use_messenger_routing: bool = False)

How the scheduler's transports hand over their messages.

Attributes:

  • use_messenger_routing (bool) –

    Hand every scheduled message to routing, so it is handled wherever routing sends its type, rather than by the worker consuming the schedule. A task naming transports is sent there either way. A transport configured with ?use_messenger_routing= on its DSN decides for itself.