Skip to content

ci: run the tests, the coverage passes and the validation check in parallel - #45

Merged
SMI-Lab-Inha merged 1 commit into
devfrom
ci/parallel-tests
Nov 19, 2026
Merged

SMI-Lab-Inha merged 1 commit into
devfrom
ci/parallel-tests

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Summary

CI ran every test serially. The required checks took 31–74 min (test matrix), 62 min (NumPy reference path) and 2 h 10 min ("Coverage and validation report": 62 min for run_validation.py --check, then 67 min for the two coverage passes). This PR runs the same tests and the same gates in parallel.

Change Where
pytest-xdist>=3.6,<4 joins the dev extra; the matrix and the reference path run -n auto --dist worksteal --durations=25 pyproject.toml, python.yml
Under xdist each worker gets its own numba cache directory before numba is imported, and removes it at the end tests/conftest.py
check_coverage.py --numprocesses N runs both coverage passes on xdist workers; pytest-cov combines the workers of each pass, and the NUMBA_DISABLE_JIT=1 kernel pass is appended to the first exactly as before release/check_coverage.py
run_validation.py --jobs=N (default 1, the serial run): the independent row groups run in spawn worker processes while _rows assembles the report, and the three taxonomy groups run beside them, each on N xdist workers validation/scripts/run_validation.py
The coverage run and the validation report check run side by side in two jobs; the required job "Coverage and validation report" needs both and fails unless both succeeded python.yml

Nothing is removed or skipped: the same tests run in every job, the threshold stays at 95 %, the kernel list and the double run are unchanged, and --check fails on exactly the same condition ("validation artefacts are stale").

Measurements (serial, before)

Local serial run of the whole suite (--durations): 34.7 min. The slowest tests are the two in test_validation_report.py that evaluate the whole report (260 s and 258 s), test_split_rows_are_pinned (241 s) and the setup of the SV11 fixture (129 s); together with test_two_way_heating_loosens_the_armour_and_converges (115 s) they are 29 % of the suite.

run_validation.py --check is the report rows (_rows(), 12.7 min under the profiler locally, 95 % of it in the SV11 split, Zeidan, SV11, anchored-wire, Dai 2020 and Ménard rows) plus three full pytest runs for the taxonomy groups (the rest of its 62 min on CI).

Design notes

run_validation.py --jobs

_rows() itself is unchanged. The independent row groups are named in _PARALLEL_GROUPS (SV11 split, Zeidan, SV11, anchored wire, Dai 2020, torque, Hu, Witz, Dai 2018). With --jobs=N, _evaluate_rows submits each group to a spawn process pool, binds the group's module-level name to the pending result for the duration of _rows(), and restores the functions afterwards. _rows() therefore takes each group's rows at the place where it calls the group, so row order and text are those of the serial run. Workers return plain tuples; --core-lay-stage is applied in each worker by the pool initializer.

The taxonomy groups run the same pytest command as before, plus -n N when xdist is installed. Their output goes to temporary files instead of pipes, so a run started before the rows never blocks on a full pipe. The passed-count parsing is unchanged. If any part fails, the remaining taxonomy runs are stopped.

numba cache

numba writes its cache atomically (a temporary file and os.replace), writes the data before the index, and on Windows tolerates EACCES from concurrent writers. Concurrent workers sharing one cache therefore risk recompilation, not wrong kernels. This PR still gives each xdist worker its own NUMBA_CACHE_DIR (in the system temp directory, keyed by the xdist run id and worker id), so no two test workers write the same files. Each worker starts from an empty cache, as a serial CI run does. A serial run keeps numba's default location, and an explicit NUMBA_CACHE_DIR is respected.

Required checks

All eleven Actions job names in the ruleset are unchanged. The two new jobs, "Coverage of the whole suite" and "Validation report is current", are not required checks. The required "Coverage and validation report" job runs with if: always() and fails unless both report success, so failure, cancellation or skipping of either one fails the required check.

Equality evidence

Whole suite, serial against -n 2 --dist worksteal (local, CI wheels)

Per-test outcomes compared from JUnit XML (numpy 2.4.6, scipy 1.17.1, numba 0.68.1):

Run Tests Passed Skipped Failed Errors Wall
serial 4585 4581 4 0 0 34.7 min
-n 2 --dist worksteal 4585 4581 4 0 0 20.4 min

The test IDs and every outcome are identical. The run left no file in the tree, and the per-worker caches were removed.

Validation rows

_rows() serially against _evaluate_rows with the pool: all 67 rows are identical as (tier, ident, quantity, target, value, status) tuples, exact string equality.

Coverage

On a subset (three kernel test files, then the NUMBA_DISABLE_JIT=1 append pass on two of them), the full coverage report of the serial and the -n 2 runs is byte-identical. The full-suite total is compared below with the last dev run (97.13 %).

Taxonomy

--check compares the taxonomy lines of the committed report exactly, so the CI validation job checks the counts under xdist against the serial report. Local serial and -n 2 runs are listed below.

The CI job times and the full-suite coverage total of this PR are added here once its run finishes.

Not parallelised

  • Each of the slowest single tests (about 4–5 min) runs on one worker, so it sets the floor of any job that runs it.
  • The coverage tracer slows the suite, so the coverage pass stays the longest single piece of work. Merging it with the "Python 3.11 on ubuntu-latest" run would slow that job down and is not done.

…rallel

The test matrix, the NumPy reference path and both coverage passes run on one
pytest-xdist worker per core (pytest-xdist joins the dev extra, bounded <4).
Under xdist every worker gets its own numba cache directory before numba is
imported (tests/conftest.py), so concurrent workers never write the same cache
files and each starts from an empty cache, as a serial CI run does.

release/check_coverage.py takes --numprocesses N; pytest-cov combines the
workers of each pass and the NUMBA_DISABLE_JIT=1 kernel pass is appended to the
first exactly as before. The 95 % threshold and the kernel test list are
unchanged.

run_validation.py takes --jobs=N (default 1, the serial run). The independent
row groups (Saevik, Zeidan, anchored wire, Dai, torque, Hu, Witz) run in spawn
worker processes while _rows assembles the report, and _rows takes each group's
rows where it calls the group, so rows, order and report are those of the
serial run. The three taxonomy groups start beside the rows, each on N xdist
workers, with their output in temporary files. --check semantics are
unchanged.

The coverage run and the validation report check run side by side in two jobs;
the required check "Coverage and validation report" now needs both and fails
unless both succeeded (it also runs, and fails, when either failed or was
cancelled). Every job name of the ruleset is unchanged.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T07:52:41.765527Z 16dea8e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableXSec | 🛠️ Build #36006385 | 📁 Comparing 16dea8e against latest (240bf9c)

  🔍 Preview build  

23 files changed · ± 23 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 16dea8e060

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit cd3b657 into dev Nov 19, 2026
14 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the ci/parallel-tests branch November 19, 2026 09:04
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