Skip to main content

Module watchdog

Module watchdog 

Source
Expand description

The watchdog for cloud jobs (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §4.4).

A scheduler can’t report its own outage, so this compares what should have run with what the ledger has:

  • A slot with no report. A cloud job’s expected slot plus its grace has passed and the ledger has no run for it: a missed row (no_report) takes the slot. A late event for that slot takes the row over and it reads “late” (storage::job_cloud), so a slot is one row whichever way it ends.
  • A run that stopped reporting. A started run with no finished event, and no heartbeat, within the job’s maxDurationMinutes becomes lost.
  • A local slot nothing handled (the second half of this file). A local job’s slot passed while AgentMux was running and the ledger has no row for it, not even a skip: the job’s scheduler task is gone or stalled. A missed row (not_started) takes the slot.

Both are failures the incident keeper judges like any other (§3.4): several misses of one job are one incident, one task and one alert. A pass runs every five minutes, and once after start-up, a little late so that what the relay held while this computer was off has been handed over first.

Structs§

LocalWatch
What the watchdog remembers between passes about the local jobs it watches. Only what happened while it ran counts: a slot from before its first pass belongs to the start-up catch-up (app_not_running), and one from before a job was edited or turned on again belongs to the old schedule.
Watched
What a pass gave up on.
WatchedJob
A cloud job as the watchdog needs it.
WatchedSchedule
The schedule a cloud job reports on, and how long after a slot its report may be.

Traits§

WatchedJobs
Where the cloud jobs to watch come from.

Functions§

start
Start the watchdog: a first pass shortly after start-up, then one every five minutes. Needs a tokio runtime; without one it does nothing.
start_local
Start the local half of the watchdog over the cron jobs in shared: a first pass shortly after start-up, then one every five minutes. Needs a tokio runtime; without one it does nothing.