Skip to content

fix(k8s): Size render pools by the container CPU quota - #8017

Merged
dan-petty merged 5 commits into
mainfrom
fix/8002-the-catalog-check-times-out-in
Dec 1, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/8002-the-catalog-check-times-out-in

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

#8002: devops k8s catalog --check renders in a fixed pool of 8 threads. With 1 or 2 CPUs, a remote base fetch can pass the 27 s git limit of kustomize.

  • Four render pools now have one worker for each usable CPU, at most 8.
  • The new dependency loky reads the CPU quota and the CPU affinity. This replaces the cgroup parser of the issue.
  • The image resolve waits on registries only, so its pool keeps 8 workers.
  • On the 2 CPUs of a small runner (fix(roadmap): a 1 CPU runner Job cannot pass the pre-push check #8005), 8 renders took one git command up to 20.6 s, and 2 renders up to 9.9 s, on a machine faster than a node.
  • Cost: on 2 CPUs, a catalog check took 132 s with 2 workers and 112 s with 8.

Closes #8002

Change: openspec/changes/archive/2026-12-01-8002-the-catalog-check-times-out-in/

@devops-cli-service devops-cli-service Bot added type/docs Type docs: a change to the documents scope/spec labels Dec 1, 2026
@devops-cli-service
devops-cli-service Bot force-pushed the fix/8002-the-catalog-check-times-out-in branch from 6fa2f9f to 4a78b59 Compare December 1, 2026 05:36
@devops-cli-service devops-cli-service Bot changed the title docs(spec): plan #8002 Size render pools by the CPU quota docs(spec): plan #8002 Size render pools by the container CPU quota Dec 1, 2026
@devops-cli-service devops-cli-service Bot changed the title docs(spec): plan #8002 Size render pools by the container CPU quota fix(k8s): Size render pools by the container CPU quota Dec 1, 2026
@devops-cli-service devops-cli-service Bot added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies and removed type/docs Type docs: a change to the documents scope/spec labels Dec 1, 2026
@devops-cli-service
devops-cli-service Bot force-pushed the fix/8002-the-catalog-check-times-out-in branch from 4a78b59 to 42903a8 Compare December 1, 2026 06:07
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Step Status Attempts Tokens in/out Last failing command
group 1 done 2 1290277/7209 pytest on base: tests/k8s/test_workers.py
group 2 done 1 2479474/8935 pytest on base: tests/k8s/test_k8s_catalog.py
group 3 done 1 2658407/6131 pytest on base: tests/k8s/test_app_render.py, tests/k8s/test_image_pins.py

@dan-petty
dan-petty force-pushed the fix/8002-the-catalog-check-times-out-in branch from 42903a8 to 1ff7ed4 Compare December 1, 2026 13:08
devops-cli-service Bot and others added 5 commits December 1, 2026 13:35
The maintained library loky reads the CPU quota of the cgroup, so the
change holds no reader of its own and the host path floor of the tests
does not change. The image resolve waits on registries only, so its pool
keeps 8 workers. The tests assert the pool sizes only, so the test-tree
check passes.
The autouse fake requested monkeypatch, so that fixture was set up before
tmp_path in every test. The removal of a temporary directory then ran
with the patches of a test in place, and one test failed at teardown.
The fake now holds its own patch context.
@dan-petty
dan-petty force-pushed the fix/8002-the-catalog-check-times-out-in branch from 1ff7ed4 to e6bb6a2 Compare December 1, 2026 13:36
@dan-petty

Copy link
Copy Markdown
Owner

Changes after the Service implement job, head e6bb6a2f1:

  • Cause of the red check: three tests of the pools asserted that the constant _WORKERS is absent. test-tree refuses that form (tests/k8s/test_app_render.py:112).
  • The hand-built cgroup parser is gone. loky.cpu_count() (BSD-3-Clause, 3.7.0) reads the same files. The alternatives check of fix(k8s): the catalog check times out in a 1 CPU container #8002 gave the verdict none, and that is wrong. The OpenSpec change now records this.
  • tests/support/host_paths.py is the same as on main. The first version let each test read /sys/fs/cgroup. A fake in tests/support/fakes/host_cpus.py replaces that.
  • The image resolve pool keeps 8 workers. The first version made it serial on 1 CPU.
  • The cgroup_root criteria in the body of fix(k8s): the catalog check times out in a 1 CPU container #8002 no longer agree with the change.

Local results:

Check Result
devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures pass
typecheck,deps,lockfile,uv-check,audit,domain pass
devops ci test (full suite, before the last rebase) 28963 passed, 3 skipped
devops ci fail-to-pass --base origin/main 7 changed tests fail on base, 0 errored
render_worker_count() in a container with a mounted cpu.max 1, 2 and 3 for 1, 2 and 2.5 CPUs; 8 for max
devops k8s catalog --check on an environment tree 1 CPU: each render done in 218 s

The fail-to-pass run and the fixture-order fix: a first CI run failed in one test at teardown, because the new fake requested monkeypatch. The last commit fixes it.

Not checked: a runner Job on a cluster node.

@dan-petty
dan-petty marked this pull request as ready for review December 1, 2026 13:52
@dan-petty
dan-petty merged commit 916e4dc into main Dec 1, 2026
44 checks passed
@dan-petty
dan-petty deleted the fix/8002-the-catalog-check-times-out-in branch December 1, 2026 14:05
dan-petty-release Bot added a commit that referenced this pull request Dec 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.270.1](v0.270.0...v0.270.1)
(2026-12-01)


### Bug Fixes

* **ai:** give Claude names the Claude request profile
([#8037](#8037))
([b4aeb94](b4aeb94))
* **ci:** read the DevContainer Image job in job-time
([#7997](#7997))
([9cf3164](9cf3164))
* **k8s:** Size render pools by the container CPU quota
([#8017](#8017))
([916e4dc](916e4dc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): the catalog check times out in a 1 CPU container

1 participant