Expand description
Notices a build-slot holder that has stopped working: its process tree has used no CPU for
IDLE_AFTER_SECS (a hung test, a prompt waiting for input, a lost network call), while
everyone else waits in the queue. Never stops anything.
Git Bash cannot do this itself: it sees no CPU time for native programs and reports pid 1 for a
parent that is one. So the script records its Windows process id (winpid in the owner file)
and srv, once a minute while a slot is held, adds up the CPU of that process and everything
below it. When it has not moved, srv
- writes
<slot>/idle(build-slot statusprints “idle for N min, no CPU”), and - tells the holder’s agent once, then at most once an hour while it stays idle.
The decisions are pure (Watch::observe, tree_cpu_ms) and the process list is a
parameter of check, so they are tested without a clock or a running build.
Structs§
- Idle
- A holder found idle.
- Proc
- One process, as far as the check needs to know it.
- Watch
- What srv remembers between looks: the run being watched.
Enums§
- Step
- What the last look at the holder found.
Constants§
- IDLE_
AFTER_ SECS - A holder whose tree used no CPU for this long is idle.
- RENOTIFY_
SECS - While it stays idle, its agent hears of it at most this often.
Functions§
- check
- One look at the slot under
rootatnow(epoch seconds).processeslists the machine’s processes and is only called when a slot is held. Keeps<slot>/idlein step with what it finds, and returns the holder when it is idle. - install
- Starts the once-a-minute look. Only the srv that runs the host’s cleanups does it, so two AgentMux channels on one machine do not both write the note or message the agent.
- note_
text - What the holder’s agent is told.
- tree_
cpu_ ms - The CPU time of
rootand every process below it, orNonewhenrootis not running.