Skip to content

Run the nightly integration tier on 2 xdist workers - #970

Merged
timlichtenberg merged 14 commits into
mainfrom
tl/integration-tier-xdist
Oct 8, 2026
Merged

timlichtenberg merged 14 commits into
mainfrom
tl/integration-tier-xdist

Conversation

@timlichtenberg

Copy link
Copy Markdown
Member

Description

The nightly integration tier now runs on 2 pytest-xdist workers per runner (-n 2 --dist worksteal) instead of serially. The test step drops from about 59 min to 19 to 35 min on ubuntu and from about 47 min to 29 to 35 min on macOS, with the same 206 passed and 11 skipped on both. The job timeout goes from 80 to 90 min, which covers setup, the tests and a cold FWL_DATA download, and the job reports its 25 slowest tests.

The worker count is fixed at 2 on both runners rather than -n auto: more workers push the heaviest integration tests close to their per-test timeouts (4 workers on ubuntu gave 5 pytest-timeout failures). A test in tests/tools/test_ci_tier_coverage.py fails if the invocation changes the worker count or drops the work-stealing scheduler, and tests/AGENTS.md says that integration tests must not share files or state with each other.

Validation of changes

Branch nightlies with 2 workers, all green:

Run ubuntu test step macOS test step
serial main (reference) 59.0 min 46.7 min
2 workers, 3 runs 34.6 / 20.0 / 18.6 min 28.8 / 34.7 / 32.9 min
  • Every run: 206 passed, 11 skipped per OS, and "created: 2/2 workers" in each log.
  • Combined coverage from the aggregator is 95.62 % (19975/20891), the same as main on the same tree; each runner uploads exactly one integration coverage file.
  • Slowest test against its timeout: ubuntu 44 %, macOS 72 % (outgas_xcheck, 217 of 300 s). The spread between runs comes mostly from smoke_janus, which runs slow on main for a separate reason.
  • The new test fails on -n auto, -n 4, a second -n, and the flag removed.

Tested on GitHub Actions (ubuntu-latest, macos-latest) and locally on macOS with Python 3.12.

Checklist

  • I have followed the contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have checked that the tests still pass on my computer
  • I have updated the docs, as appropriate
  • I have added tests for these changes, as appropriate
  • I have checked that all dependencies have been updated, as required

The integration tier takes 59 min serially on ubuntu and 47 min on macOS, which leaves no room inside its 80 min budget once setup-proteus is slow. Its tests each write into their own temporary directory, so they run on one xdist worker per core, with work stealing to balance the few long runs against the many short schema tests.
With psutil installed, xdist's auto mode counts physical cores, which on a runner with hyperthreading is half its vCPUs. The logical mode uses every vCPU, and without psutil it falls back to the same affinity count as auto.
The ubuntu runner has 4 vCPUs on 2 physical cores. With 4 workers the CPU-bound tests slow down past their per-test timeouts, while xdist's auto mode (psutil physical cores) gives 2 workers on ubuntu and 3 on macOS and keeps both green. The job timeout moves to 90 min so a cold FWL_DATA download still fits next to the measured test time.
xdist's auto mode counts physical cores only when psutil imports, and falls back to the logical count otherwise, which oversubscribes the ubuntu runner. The develop extra now requests pytest-xdist with its psutil extra instead of relying on a transitive install, and the integration step prints the 25 slowest tests so the headroom to the per-test timeouts shows in every nightly.
On three workers the macOS runner brings the heaviest integration tests to 92 % of their timeouts, because the outgas cross-checks and the JANUS smoke test end up running together. The integration matrix now carries a worker count per OS: physical cores on ubuntu, two on macOS.
Both runners take a literal `-n 2` in place of the per-OS worker matrix, so the worker count no longer depends on psutil or on the runner topology, and the psutil extra goes. A test reads the integration-tier pytest command from the workflow and requires `-n 2 --dist worksteal`, and tests/AGENTS.md states that the tier runs on 2 workers.
The guard reads every -n and --dist value from the shell-split pytest command, so a second -n later in the line, or the -n2 and --numprocesses=2 spellings, are read the way pytest reads them.
The guard now parses the integration-tier command with pytest and pytest-xdist loaded, so clustered short flags such as -vn3, the -d shortcut for --dist=load, --maxprocesses and --tx are read as the nightly reads them. A parametrized test pins the helper on literal command lines.
This reverts 778f43e, 5c5398e and 5943257. The guard returns to reading the integration-tier command as text.
The guard requires exactly one -n in the integration-tier command, followed by 2, so a later -n in the same command fails it.
@timlichtenberg
timlichtenberg requested a review from a team as a code owner October 8, 2026 06:57
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.65%. Comparing base (ed24232) to head (e0a1f7f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #970      +/-   ##
==========================================
- Coverage   93.97%   93.65%   -0.33%     
==========================================
  Files         128      128              
  Lines       20891    20891              
  Branches     3515     3515              
==========================================
- Hits        19633    19566      -67     
- Misses        908      914       +6     
- Partials      350      411      +61     
Flag Coverage Δ
nightly 93.62% <ø> (+0.08%) ⬆️
unit-tests 92.27% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timlichtenberg
timlichtenberg merged commit 4fc66f8 into main Oct 8, 2026
48 checks passed
@timlichtenberg
timlichtenberg deleted the tl/integration-tier-xdist branch October 8, 2026 12:05
IKisvardai added a commit that referenced this pull request Oct 9, 2026
Brings in the prescribed orbital migration (#937), the CALLIOPE cold-start
seed (#958), the fwl-io dataset fetch and stellar spectra changes (#960,
#964, #967, #968), the PETSc download (#965), Zalmoxis Anderson acceleration
with fwl-aragog 26.10.08 (#971) and the CI changes (#955, #970). The schema
invariant tests keep both the trapping and the migration validators, and the
golden trajectory is main's re-recorded one with the trapping columns added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant