Repository navigation
scheduler: stale unclaimed jobs stop blocking; admin cancel for unclaimed scheduled jobs - #183
Merged
Merged
Conversation
…imed scheduled jobs
A scheduled job that stays not_started and was never claimed (for example on
an offline machine) blocked every later slot as overlap, and then target
validation skipped the whole run.
- Overlap ignores a never-claimed not_started job older than one cron interval
of its schedule plus a two-minute grace. Leased jobs always count.
- A target still holding such a stale job is left out of that run (recorded in
audit); the other targets still run. If every target is stale the slot is
skipped_unavailable.
- New POST /v1/operator/schedule-jobs/{id}/cancel (admin or operator-admin
service token): reason and Idempotency-Key required, cancels only an
unclaimed not_started scheduled job (becomes rejected), receipt replay and
schedule-job-cancel audit. CLI tool schedule_job_cancel in clawctl-operator.
- Tests for staleness, partial runs, cancel store/API/CLI; route tallies and
docs updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A scheduled job that stays
not_startedand is never claimed (for example, on a machine that went offline) made every later slot of that scheduleskipped_overlap. Without it, target validation would still skip the whole run because that target has an active job. There was no sanctioned way to clear such a job without a raw DB edit.What
(a) Stale unclaimed jobs stop blocking
lease_tokenNULL)not_startedjob created more than one cron interval of its schedule (plus a 2-minute grace) before the slot. A job right after its own slot still counts as overlap, as before. Leased jobs always count.skipped_unavailable.(b) Admin cancel for an unclaimed scheduled job
POST /v1/operator/schedule-jobs/{id}/cancel, for admin or an allowlistedoperator-adminservice token.{"reason"}and anIdempotency-Key.not_startedjob with no lease. The job becomesrejected.schedule-job-cancelaudit row.SCHEDULE_JOB_NOT_FOUNDfor an unknown job and 412PRECONDITION_FAILEDfor a claimed or finished job.clawctl-operatortoolschedule_job_cancel.Tests