Repository navigation
perf(planning): run the Python suite in parallel with pytest-xdist - #9017
Conversation
Pin pytest-xdist 3.8.0 and its dependency execnet 2.1.2 in .github/requirements-ci.txt (wheel hashes from PyPI). test-python now runs each plugins/planning/surface/ module with -n auto --dist loadscope; loadscope keeps a test class on one worker, since TestApi's tests share ordered class state. Every other module runs as before, one process per module, and the loop still runs every module after a failure and fails the step if any failed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR 9017 (head 2ba4f03)Findings: 0. No inline comments posted. PR is open and touches two files:
|
|
claude-review reviewed No findings. I reviewed the 2-file diff ( What I checked
Not verified
Observation, not a finding
|
Refs: #8757
Summary
The four planning surface Python modules (
test_server,test_exporters,test_round,test_schemaunderplugins/planning/surface/) take 318 s serially on the dev host (394 suite-seconds inscripts/suite-seconds.txt). This runs each of them on pytest-xdist workers intest-python.This links #8757 without closing it: the issue's verification is the local
scripts/check-affected.sh --testsgate under a budget, and that gate runs no Python (affected-tests.shnamestest_*.pyas NOT RUN and exits 3), so this PR changes CI only.Fix
.github/requirements-ci.txt: pinpytest-xdist==3.8.0(latest release; requirespytest>=7.0.0) and its one dependencyexecnet==2.1.2, one wheel hash each, from PyPI's JSON API. Local venvs (scripts/setup-env.sh) and the lane test-file runner install from the same file..github/workflows/pr-require-checks.yml,test-python: thexargsloop becomes awhile readloop that adds-n auto --dist loadscopeforplugins/planning/surface/*modules only. Every module still runs in its own process, every module still runs after a failure, the command is still echoed, and the step fails if any module failed.loadscopekeeps each test class on one worker, sinceTestApi's tests share ordered class state.plugins/planning/shared/tests/stays serial. Under-n auto(24 workers, host load average 60 to 96),test_share.pyfailed twice with "the server did not start within 15 s". It passed serially and at 4 workers. That points to timing sensitivity under load, so it is left out.Verification
PYTEST_XDIST_AUTO_NUM_WORKERS=4, the hosted runner's vCPU count), at host load average about 20 on 24 cores: 648 passed, 1 skipped, 0 failed. The leg log of this PR's CI run will show the hosted runner's figure.pip install --only-binary=:all: --require-hashes -r .github/requirements-ci.txt(viascripts/setup-env.sh) installed xdist 3.8.0 and execnet 2.1.2, which checks the hashes.actionlintclean. Passing:check-hook-exec-form.test.sh,portfolio-facts.test.sh,ci-ordered-skips.test.sh,plan-test-lanes.test.sh,check-docs-only-gate.test.sh,setup-env.test.sh,setup-env.test.mjs,check-script-contract.test.sh,dependency-classify.test.mjs,collect-base-activity.test.mjs, andci-test-node-stop-commands.test.sh(with the venv Python; without PyYAML on PATH it fails the same way on main).Follow-up: the surface entries in
scripts/suite-seconds.txtnow overstate their time. That costs leg balance only, not coverage. Remeasure them from a whole-tree run.Related
#8757, #3716
🤖 Generated with Claude Code