Skip to content

ci(gate): sample memory and disk while a lane runs (#2593) - #2980

Merged
zackees merged 2 commits into
masterfrom
infra/2593-resource-samples
Oct 30, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2593-resource-samples

Conversation

@zackees

@zackees zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member

Refs #2593 (part A4 of the Decided: at 11:32Z; A3 stays open).

What and why

The merge queue's worst stall in #2593 was a runner that died mid-job: exit 143, every later step "completed", the job still in_progress until the timeout. The log streamed up to that point is all anyone gets, and it did not say whether the runner had run out of memory or disk. This prints one memory and disk sample into that live log every 30 s while a lane's child runs, which is what the next lost runner needs to be diagnosable.

The gate already streams every lane's child through run() in ci/local_gate.py, so the sampler lives there rather than in a workflow step: one call site covers the lint, rust-test, cross and cross-release lanes on every caller (local ./lint / ./unittest, Local Gate (lint) in build-project.yaml, and the Windows/macOS Rust test steps that call the same lanes). OBS_GATE_RESOURCE_SAMPLES=0 turns it off.

  • resource_sample() returns one line: resources: mem <used> MB used of <total> MB (<available> MB available) disk <used> GB used of <total> GB (<free> GB free). Memory comes from /proc/meminfo, disk from shutil.disk_usage(ROOT); a host without /proc/meminfo (macOS) reports mem unavailable and still reports disk.
  • sample_while(emit) is a daemon thread that prints a sample every 30 s until the child exits, so a killed runner's last streamed lines include the last sample.
  • Samples are skipped when run() is given a buffer (the step that runs beside Clippy): that buffer is only printed after the child finished, which is too late to be evidence.

RED → GREEN

  • RED b1c8ce44b: ci/test_resource_samples.py against the unchanged gate. All four cases error on mock.patch.object(local_gate, "RESOURCE_SAMPLE_SECONDS", ...): AttributeError: ... does not have the attribute 'RESOURCE_SAMPLE_SECONDS'.
  • GREEN 556fa6667: the sampler. uv run python -m unittest discover -s ci -p test_resource_samples.py → 4 tests, OK; ./lint → lane lint: ok (71.0s).

The four cases: the sample names memory and disk on one line; it degrades to disk alone when /proc/meminfo is absent; run() prints a sample while a child runs; OBS_GATE_RESOURCE_SAMPLES=0 suppresses them.

Scope

  • Part A (timeouts) landed as ci: Bound Rust job timeouts at 2x so a lost runner cannot hold the queue (#2593) #2618. This is A4 only. A3 (automatic re-run on a lost runner) is deliberately left: the Decided: calls it a workflow-behaviour choice with a cost, and may implement A4 and leave A3.
  • No workflow file, no new Actions job, no new cache writer: the change is inside the existing gate process.
  • No docs/features.md line: CI-only, nothing a user of OBS can notice.

@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

CI is green and the PR is queued.

  • CI Gate ✅ (run 40997048414, job 123875589802); Build 🧱 / Fast Gate ⚡ passed in 5m32s, Format 🔍 / checks (the ci/ Self-Tests step that runs every ci/test_*.py, including the new one) passed in 57s. The Rust lanes were not selected: the diff is two ci/ paths.
  • Local: uv run python -m unittest discover -s ci -p test_resource_samples.py → 4 tests OK; ./lint → lane lint: ok (71.0s). ./unittest was not run: no libobs/, Rust or C source changed.

Handed off to the coordinator.

Merged via the queue into master with commit f6378ee Oct 30, 2026
35 checks passed
@zackees
zackees deleted the infra/2593-resource-samples branch October 30, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant