Pull pipeline/ from boilerplate a80ad8a: cadence picker, queue badge, label refresh

The schedule cadence is a picker, the add row is behind a button and off
here, a running-jobs chip with Kill and Stop run sits in every header, and
a declared schedule's label is refreshed at startup.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 16:22:46 +02:00
1 parent cebe62ddc9
commit 3a240e51df
16 files changed
+828 -167

No files matched your search

+3 -3
View File
@@ -11,7 +11,7 @@ A jobs **table in SQLite** with an async worker draining it. Handlers are plain
| Workers | threads, several at once, one per running job, from a pool of the queue's own |
| Storage | one SQLite file (WAL). Point it at the app's DB or one of its own |
| Concurrency | threads within a worker; any number of workers on one file — `claim` is one atomic `UPDATE`, and a claimed job is held on a lease its worker renews. `python -m pipeline.worker` starts one with no web app; `pipeline/tests/test_housekeeping.py` races two |
| Web | `pipeline.web.connect(app, jobs, config, store)` — routes, socket, the `<desk-jobs>` and `<desk-schedules>` elements, and the worker in the app's lifespan |
| Web | `pipeline.web.connect(app, jobs, config, store)` — routes, socket, the `<desk-jobs>`, `<desk-queue>` and `<desk-schedules>` elements, and the worker in the app's lifespan |
| States | `queued → running → done \| failed \| cancelled`, and `running → queued` again for a job with an attempt left |
| Scheduling | five cadences on a `schedules` row in the same file — `every 15m`, `daily at 06:00`, `weekly mon 07:00` — fired from the drain loop, defaults declared next to `@job` |
| Door | `from pipeline import DAYS, FINAL, FORMS, JOBS, MAX_RESULT, NULL, SCHEDULES, TASKS, TERMINAL, BadCadence, Batch, Bound, Cadence, Cancelled, CascadeProgress, ChildFailed, Declared, Handler, Job, JobQueue, JobState, Jobs, JobsSnapshot, Listener, Notice, NoticeEntry, NoticeKind, NoticeLevel, NoticeListener, ResultTooLarge, Retry, Run, RunCancelled, RunContext, Schedule, ScheduleListener, Spec, Tally, Task, TaskProgress, declare, fan_out, job, local_zone, notices, spawn` |
@@ -42,7 +42,7 @@ Jobs are tied to a task and a cascade by `task_id` and `cascade_id`.
**Cadence** — one of five wordings, and the only five: `every 15m`, `every 6h`, `every 2d`, `daily at 06:00`, `weekly mon 07:00`. Not cron, which is five fields of positional punctuation that nobody reads back correctly. The interval forms are elapsed time and ignore the timezone; the clock forms are wall-clock in `JobQueue(tz=...)` and are 06:00 on both sides of a daylight-saving change. The two mean different things and a person picking one has already chosen which.
**Declaration** — a default schedule an app ships, written next to `@job` with `declare(name, kind, cadence, payload, label)`. `SCHEDULES` is to it what `JOBS` is to `@job`. On start, a declared name with no row gets one and a name that has one is not touched, so the declarations are where a schedule *comes from* and the table is what it *is*.
**Declaration** — a default schedule an app ships, written next to `@job` with `declare(name, kind, cadence, payload, label)`. `SCHEDULES` is to it what `JOBS` is to `@job`. On start, a declared name with no row gets one and a name that has one keeps everything but its label, so the declarations are where a schedule *comes from* and the table is what it *is*.
## How a job has to look
@@ -294,7 +294,7 @@ The tick is in the drain loop, at the top of `_turn`, before the claim — not i
**A row the code no longer supports keeps its place.** An unregistered kind, or a cadence nothing can parse (only reachable by editing the file by hand), is logged once per process and left exactly as it is — `next_run` included — so registering the handler again runs it rather than starting another cadence. `<desk-schedules>` marks the row `unknown kind`; deleting it is deliberate.
**Reconciliation never overwrites and never deletes.** `Jobs.add_schedule(..., only_if_new=True)` is the whole of it: one statement, so two workers starting at once insert a declared default once between them. A declaration removed from the code leaves its row behind, because a deploy that silently forgot a schedule somebody relied on is worse than an orphan that says so.
**Reconciliation overwrites only the label and never deletes.** `Jobs.add_schedule(..., only_if_new=True)` is one statement, so two workers starting at once insert a declared default once between them. `Jobs.relabel_schedule` then refreshes the label of a row that still has the declared kind: no screen edits a label, so the row's copy is only ever an older declaration's. A declaration removed from the code leaves its row behind, because a deploy that silently forgot a schedule somebody relied on is worse than an orphan that says so.
**One scheduler per file.** `JobQueue(schedules=False)` and `pipeline.worker --no-schedules` are what every worker after the first passes. The workers themselves race correctly — that is `claim` — but the pile-up guard reads `last_job_id`, which neither of two simultaneous firings has written when the other looks.