Skip to main content

Module scheduler

Module scheduler 

Source
Expand description

Which runners to start and stop, as a pure function of queued jobs, slots and the memory budget (plan), and the loop that applies those decisions with GitHub and Docker (engine). plan does no I/O and reads no clock.

Modules§

engine
The scheduling loop: polls GitHub, 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 (from observe::capture), steps from GitHub, mirror bytes, cache sizes and slot and budget changes. It owns slot state; it never serves the API (it publishes api::Status and takes commands through Control) and never logs the token or a JIT config.

Structs§

Profile
A profile’s slots: one concurrent job each.
Repository
A repository as the planner sees it.
RunnerSlot
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 plan decides for one slot.
Slot
What a slot holds.

Constants§

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.

Functions§

matches
Whether a job may run on a repository’s runners: every label it asks for is one of theirs. GitHub compares labels without regard to case.
plan
Decides which slots start a runner and which idle runners stop.