schedule_registry
schedule_registry
¶
Durable recurring-score registrations and exact due-time claims.
The registry is a small projection in the conductor state database. It never
executes score sources or calculates recurrence; callers supply validated
ScheduleConfig instances and their calculated next epoch due time.
Classes¶
ScheduleRegistryError
¶
Bases: RuntimeError
Base error for a diagnosable schedule-registry failure.
ScheduleRegistryBusyError
¶
Bases: ScheduleRegistryError
The bounded SQLite wait expired while another writer held the database.
ScheduleRegistryDataError
¶
Bases: ScheduleRegistryError
A persisted schedule row cannot safely be interpreted as registry state.
ScheduleRegistryClaimError
¶
Bases: ScheduleRegistryError
A lifecycle update does not match a durable claimed due identity.
ScheduleRecord
dataclass
¶
ScheduleRecord(schedule_id, score_name, score_path, schedule_json, source_digest, enabled, next_due_at, created_at, updated_at, last_due_at, last_run_id, last_outcome, consecutive_drops, pinned_source_digest=None, diagnostic=None, registration_id=None)
Persistent schedule projection visible to the recurrence controller.
DueClaim
dataclass
¶
The durable identity of a schedule tick claimed by this conductor.
ScheduleRegistry
¶
Async SQLite schedule registry with atomic, durable due-time claims.
last_claimed_due_at is intentionally private schema state: it is a
durable idempotency key, not schedule status exposed to users. A claim is
never released, so reopening the conductor cannot submit the same due time
twice.
Source code in src/marianne/daemon/schedule_registry.py
Methods:¶
open
async
¶
Open the state database and add the schedules table if necessary.
Source code in src/marianne/daemon/schedule_registry.py
identity
async
¶
Return the identity of this durable state database, across restarts.
upsert
async
¶
upsert(schedule_id, score_name, score_path, schedule, source_digest, next_due_at, *, pinned_source_digest=None, registration_id=None)
Insert or replace a schedule declaration without losing its creation time.
pinned_source_digest stores launch-side authority in this
daemon-owned row: when set, ticks must refuse byte or identity drift
instead of re-binding. Each registration re-derives it from the
pinning declaration, so a conscious re-registration amends the pin.
Source code in src/marianne/daemon/schedule_registry.py
terminal_for
async
¶
Read a completed cancellation bound to one caller-held registration.
Source code in src/marianne/daemon/schedule_registry.py
record_terminal
async
¶
Record completed stop only while no later registration owns this ID.
Source code in src/marianne/daemon/schedule_registry.py
get
async
¶
Return one durable schedule record, or None when it is absent.
Source code in src/marianne/daemon/schedule_registry.py
list
async
¶
List projections, surfacing malformed rows as safe disabled diagnostics.
Startup restoration must not let one damaged durable projection prevent
every other schedule from restoring. get() remains strict for a
caller that explicitly requests that row; the bulk view returns one
safe disabled diagnostic without deserializing the damaged payload.
Source code in src/marianne/daemon/schedule_registry.py
pause
async
¶
Disable future claims for a schedule without deleting its history.
resume
async
¶
Enable future claims for a schedule without recalculating recurrence.
remove
async
¶
Remove a registration and all of its durable lease state.
Source code in src/marianne/daemon/schedule_registry.py
claim_due
async
¶
Atomically claim one exact due identity, if it remains due and enabled.
Source code in src/marianne/daemon/schedule_registry.py
record_submission
async
¶
Persist a claimed tick's child identity without advancing recurrence.
Source code in src/marianne/daemon/schedule_registry.py
record_tick_outcome
async
¶
Persist a claimed tick outcome and caller-calculated next due time.