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:
1 parent
cebe62ddc9
commit
3a240e51df
16 files changed
+828
-167
No files matched your search
+18
-4
@@ -943,11 +943,12 @@ class Jobs:
|
||||
only_if_new: bool = False) -> Schedule | None:
|
||||
"""Write one schedule. `None` when `only_if_new` and the name is taken.
|
||||
|
||||
`only_if_new` is the whole of reconciliation: the queue offers every
|
||||
`only_if_new` is most of reconciliation: the queue offers every
|
||||
declared default on every start, and a name that already has a row is
|
||||
left exactly as the user edited it — cadence, payload, enabled and all.
|
||||
Which is what makes a declaration a starting point rather than a
|
||||
setting somebody has to fight.
|
||||
left as the user edited it — cadence, payload, enabled and all. Which
|
||||
is what makes a declaration a starting point rather than a setting
|
||||
somebody has to fight. The label is the exception, and
|
||||
`relabel_schedule` is where it is refreshed.
|
||||
|
||||
One statement, so two workers starting at once insert a declared
|
||||
default once between them rather than racing a read against a write.
|
||||
@@ -969,6 +970,19 @@ class Jobs:
|
||||
).fetchone()
|
||||
return self.schedule(row["id"]) if row else None
|
||||
|
||||
def relabel_schedule(self, name: str, kind: str, label: str) -> bool:
|
||||
"""Give a declared row the label its declaration now carries.
|
||||
|
||||
Only when the kind still matches: a row whose kind was changed is no
|
||||
longer the declared schedule in anything but its name, and a label
|
||||
written for another job would misname it. One statement, like
|
||||
`add_schedule`, and a no-op when the label is already right, so a
|
||||
restart writes nothing.
|
||||
"""
|
||||
return bool(self._write(
|
||||
"UPDATE schedules SET label=? WHERE name=? AND kind=? AND label<>?",
|
||||
(label, name, kind, label)))
|
||||
|
||||
#: What `update_schedule` will write, and the whole of it. A whitelist
|
||||
#: rather than trust, because the column names go into the statement: the
|
||||
#: values are parameters but the keys cannot be, so this is the boundary.
|
||||
|
||||
Reference in new issue
Block a user