Skip to main content

Module admission

Module admission 

Source
Expand description

Admission by measured peaks: a job’s memory peak and average CPU predicted from the job history (Predictor), and the history replayed through admission by caps and by predictions, with or without a CPU budget (simulate), to show what each would have done with the same jobs; and what the host’s memory leaves runners (host). A job’s memory goes by its last runs (recent, ADR 0070). Pure: no I/O, no clock.

Modules§

host
What the host’s memory leaves runners beside its other programs (ADR 0055): the slice’s runners may hold what they hold now without page cache plus the host’s MemAvailable, less a margin kept for the host’s page cache, so reclaim stays cheap; and nothing starts while the host, short of memory, stalls for it. Each bound has hysteresis, so a host at the edge does not start and hold runners by turns. Pure: the engine passes in the reading and what it remembers of the last plan.
recent
A job’s recent runs, as admission and sizing read them (ADR 0070): each row of the history read once, in the order the runs finished, into a window of the job’s last successful runs, the hold a run at its cap puts on it, and the runs past what they reserved. One rule for what each row says, whoever feeds it: the engine’s predictor, simulate and sizing. Pure: no I/O, no clock; it must not keep anything the rows do not say, so a restart that reads the same rows decides the same.

Structs§

CpuPrediction
The CPU a runner reserves for a job, in millicores, at most its profile’s cpus, and what it goes by.
Key
A job as admission tells jobs apart: its repository, workflow and name.
Prediction
The memory admission reserves for a job, at most its cap, and what it goes by.
Predictor
Predicts a job’s peak from the runs it learned.
Replay
What a replay did with the history’s jobs.

Enums§

Copies
Whether other copies of a job may run beside the one predicted: queued with it, or running. A few light runs say little about a burst of copies, after a cache was invalidated, so only one copy at a time goes by them.
Policy
How a replay admits a queued job.

Constants§

CPU_GRANULE
CPU predictions round up to this many millicores: a tenth of a CPU.
HIGH_WATER
While the slice uses this percent of its MemoryMax or more, measured admission starts nothing.
OWN_RUNS
From this many successful runs of its own, fewer than [sizing] min_jobs runs, a job reserves its own largest peak while no other copy of it is queued or running; otherwise the larger of that and its profile’s p95.
UNPREDICTABLE_FOR
For at most this long after a run at its cap or killed for memory, in milliseconds, its job is admitted at its cap: 7 days, or until recent::CLEAN_RUNS clear runs. After a run past what it reserved, its job reserves its largest peak for at most as long, or until the run leaves its window.

Functions§

simulate
Replays jobs through policy: each arrives when it was queued and runs as long as it ran, in a profile with slots (by name; the config’s where absent) under the slice’s memory_max. Jobs start as soon as the policy admits them, oldest first, a job that does not fit letting a later one past, as scheduler::plan does. Measured admission predicts from the runs finished before it decides, as the daemon would, and holds each running job at its peak for its whole run, which the daemon does not see. A job with copies waiting or running beside it is predicted as one with Copies::Several. Each moment, the running jobs are predicted again, the first running copy of a job going by its own runs, as the daemon does each tick. Unlike the daemon, the replay knows a job from its start: it never sees a runner whose job is not known yet, and the order jobs started stands for the daemon’s slot order.