Expand description
Which runners to start and stop, as a pure function of queued jobs, slots, warm runners and the memory and CPU
budgets (plan), how many warm runners each repository wants (warm), and the loop that applies those decisions
with GitHub and Docker (engine). plan and warm do no I/O and read no clock.
Modules§
- engine
- The scheduling loop: polls GitHub, pulls the profiles’ images, applies
plan’s decisions with GitHub and Docker, removes each runner’s container when its job ends, keeps the mirror up while any runner runs, reseeds idle profiles and recovers runners and containers a previous daemon left. It also feeds the job history: queued jobs, the job each runner took (fromobserve::capture), steps from GitHub, mirror bytes, cache sizes and slot and budget changes. It owns slot state; it never serves the API (it publishesapi::Statusand takes commands throughControl) and never logs the token or a JIT config. - warm
- How many warm runners each repository’s pool wants (ADR 0050, 0058): its
warmwhile the repository is active, by its jobs of the last hour and the hours of the day its jobs usually come, plus the jobs for the pool its workflow runs seen so far are expected to queue still, from the history. Pure: the engine reads the history and the clock and passes them in.
Structs§
- Budget
- The budgets a plan starts runners within.
- Hold
- A repository’s runners held back after they failed.
- Plan
- What
plandecides, and why each queued job it starts no runner for waits. - Pool
- Names one of a repository’s pools: its runners in one profile (ADR 0058). No two pools of a repository share a profile.
- Profile
- A profile’s slots: one concurrent job each.
- Repository
- One of a repository’s pools as the planner sees it: its runners in one profile, registered with one set of labels
(ADR 0058). A repository with one
[[repositories]]entry has one. - Runner
Slot - A slot whose container runs a runner registered for one job.
- SlotRef
- Where slots are, by profile name and slot index (0 is slot 1).
Enums§
- Decision
- What
plandecides for one slot. - Preparing
- Why none of a profile’s slots starts for now.
- Slot
- What a slot holds.
Constants§
- CPU_
PRIORITY_ AFTER - Once a job has waited this long for CPU, no younger job takes CPU until it fits: smaller jobs arriving all the time would otherwise take every CPU that frees up before it.
- IDLE_
TIMEOUT - How long a started runner may wait for a job before it counts as surplus: covers the container’s start and GitHub’s assignment.