Skip to main content

Crate schedr_master

Crate schedr_master 

Source
Expand description

The schedr master: scheduling loop, DAG validation, command handling, gRPC server.

So far: DAG discovery (discovery) with its checks of DAG JSON (validate), parse jobs (parse_jobs) and the DAG list worked out from the parses (catalog).

Modules§

catalog
The DAG list worked out from the current parse of each root.
clock
Master time (B225, B228): the one clock every liveness decision of the cluster reads.
commands
Applying commands: the master reads pending command rows, oldest first, and applies each through the scheduler and the dispatcher (see archive/PROJECT.md, Web UI and CLI).
core
The master’s protocol logic, apart from any transport: registering workers, their messages, disconnects, the periodic tick, parse uploads and inputs (see archive/PROJECT.md, Master–worker protocol and Worker lifecycle).
discovery
DAG discovery on the master: reported hashes, parse jobs, uploaded parses and the DAG list.
dispatch
Giving tasks to workers and handling what workers report about them (see archive/PROJECT.md, Task assignment and Task rejections).
execution
Moving runs forward: task instances for new runs, results of attempts, retries whose delay passed, cancelling, and the run result (the rules are in crate::progress).
fire_times
Fire times of a DAG’s time trigger, with schedr’s daylight-saving rules.
lease
Leading: one master per database (see archive/PROJECT.md, Components and roles: production path).
limits
Concurrency limits (see archive/PROJECT.md, Native API: Concurrency limits, decisions 87-91): max_active_tasks on a DAG, max_active and max_active_per_run on a task.
mapping
Mapped tasks (decisions 69, 70, 74-79): which edges are lanes, the dimensions a mapped task’s instances span, an instance’s place in each, and the master’s resolution of what a task is mapped over.
metrics
The master’s metrics (see archive/PROJECT.md, Observability), registered in the process’s registry and served on the ops port.
notifications
Notifications (decisions 408-429): which channels hear of an event, the message each gets, and the checks on a DAG’s notify=.
params
A DAG’s run parameters (decisions 133, 135, 138): the check of its schema when the DAG is validated, and of a run’s values before the run exists.
parse_jobs
Parse jobs: each (root, content hash, schedr version) is parsed once, by one worker that reported it. A parse whose files failed transiently (a timeout, a runner that died) is parsed again (decision 72.2), after a delay that doubles with each retry up to MAX_RETRY_DELAY, preferring another worker: without a limit, since the code may be fine.
planning
The rules for run times and new runs (see archive/PROJECT.md, Native API: run time semantics, and Runs: manual runs, backfill and pausing).
problems
A master’s problems now (decision 129): what its heartbeat writes to its row, shown on its node on the Deployments page. Each kind of problem is one entry, set while it lasts and cleared once it is over.
progress
How a run’s tasks move forward: readiness (NoneFailed), retries, cancelling and the run result (see archive/PROJECT.md, Outcomes, failures and joins, and Task assignment).
quiet
Which DAGs a scheduler round visits (decision 485; first “Quiet DAGs”, archive/PROJECT.md).
retention
The master’s retention job (decisions 430-435): every SCHEDR_HIDDEN__MASTER__RETENTION_INTERVAL (1 h) while it leads, it deletes what [retention] no longer keeps, a batch of SCHEDR_HIDDEN__MASTER__RETENTION_BATCH runs per transaction, until nothing is left, so it never holds long locks nor holds the scheduler up (it runs beside the master’s loop).
samples
A sample of each schedr process a minute (decision 464): the leading master writes its masters’ and workers’ (one row per process, however many roles it runs: a standalone is one), rolls each closed 15-minute window up into averages and peaks, and deletes minute rows past a day and rollups past 30 days. A webserver in a process of its own writes its own.
scheduler
The scheduler pass: new scheduled runs, queued runs started, and manual runs.
service
The master’s gRPC service and its loop: workers’ Control streams, parse uploads and FetchInputs, over MasterCore (see archive/PROJECT.md, Master–worker protocol).
validate
The master’s checks of uploaded parse results.
workers
The workers the master knows, their queues and slots, and the choice of a worker for a task (see archive/PROJECT.md, Task assignment).