Repository navigation
ci: run the tests, the coverage passes and the validation check in parallel - #45
Merged
Merged
Conversation
…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>
Codex Review Summary: ✅ CompletedThis 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. |
Owner
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pytest-xdist>=3.6,<4joins thedevextra; the matrix and the reference path run-n auto --dist worksteal --durations=25pyproject.toml,python.ymltests/conftest.pycheck_coverage.py --numprocesses Nruns both coverage passes on xdist workers; pytest-cov combines the workers of each pass, and theNUMBA_DISABLE_JIT=1kernel pass is appended to the first exactly as beforerelease/check_coverage.pyrun_validation.py --jobs=N(default 1, the serial run): the independent row groups run in spawn worker processes while_rowsassembles the report, and the three taxonomy groups run beside them, each on N xdist workersvalidation/scripts/run_validation.pypython.ymlNothing 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
--checkfails 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 intest_validation_report.pythat 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 withtest_two_way_heating_loosens_the_armour_and_converges(115 s) they are 29 % of the suite.run_validation.py --checkis 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_rowssubmits 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-stageis applied in each worker by the pool initializer.The taxonomy groups run the same pytest command as before, plus
-n Nwhen 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 toleratesEACCESfrom concurrent writers. Concurrent workers sharing one cache therefore risk recompilation, not wrong kernels. This PR still gives each xdist worker its ownNUMBA_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 explicitNUMBA_CACHE_DIRis 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 reportsuccess, 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):
-n 2 --dist workstealThe 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_rowswith 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=1append pass on two of them), the fullcoverage reportof the serial and the-n 2runs is byte-identical. The full-suite total is compared below with the lastdevrun (97.13 %).Taxonomy
--checkcompares 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 2runs 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