runner
runner
¶
Host-side slot execution — image assembly, build, run, teardown.
The shared Containerfile templates ship inside this package; a consuming
repo customises them declaratively (extra-packages becomes the
EXTRA_PACKAGES build arg) or, for genuinely repo-specific image
tweaks, drops a fragment next to its matrix.yml
(fragments/Containerfile.<slot>) that the engine appends verbatim.
Process output streams straight to the operator's terminal (podman build
and the test run are long and live); all narration around it belongs to
cli.
SlotResult(passed, observed='?', network_hint=None)
dataclass
¶
Outcome of one slot run: pass/fail, observed version, network hint.
network_hint is set only on a failing slot whose output carried a
host network/DNS error signature — a nudge that the failure may be
infrastructure, not the code, so a rerun is worth trying before trusting
it. None when the slot passed or showed no such signature.
render_containerfile(config, slot_name)
¶
Shared template plus the repo's optional fragment, ready to build.
Source code in src/terok_util/matrix/runner.py
build_image(config, slot_name, results_dir, no_cache=False)
¶
Assemble and build the slot image; the repo root is the build context.
Source code in src/terok_util/matrix/runner.py
run_slot(config, slot_name, results_dir, scope='all', line_prefix='')
¶
Run one slot's test container and collect its observed version.
Two shapes, one result: an --init container that is the outer
script, or, for a slot that boots systemd under krun and whose image
ships it, a booted microVM whose systemd runs the outer script as a
service (_run_in_booted_slot).
Output streams in bounded chunks, tagged at line starts with
line_prefix when set. Ordinary lines remain single writes; oversized
lines may interleave with other slots. Chunks are scanned for host
network/DNS error signatures; on failure the first match becomes the
result's network_hint.
Source code in src/terok_util/matrix/runner.py
sweep_containers(config)
¶
Remove leftover run containers owned by this harness.
podman run --rm cleans up after itself — but an interrupted run
leaves the container behind, and a leftover container pins its (by
then dangling) image generation, immune to any prune. The sweep is
what lets the prune that follows actually reclaim the bytes.
Returns:
| Type | Description |
|---|---|
int
|
The number of containers removed. |
Source code in src/terok_util/matrix/runner.py
prune_dangling(config)
¶
Prune dangling generations of exactly this harness's images.
Idle CPU/IO priority when available — small per-run increments instead of an hours-long backlog. A failed prune is warned about, never raised: teardown must always run to completion. Returns the number of pruned image records.
Source code in src/terok_util/matrix/runner.py
external_storage_leftovers()
¶
Name the external (buildah) containers stuck holding storage.
These pin dangling image layers but were not created by this engine —
removing them here could tear a live podman build out from under
another process, so recovery is superbuild's job; the CLI only names
them. Returns the container names (or ids, for nameless entries).