Skip to content

[RTR] ci: run independent test shards with two pytest workers - #1117

Merged
pariterre merged 6 commits into
pyomeca:masterfrom
mickaelbegon:codex/ci-xdist-tests
Oct 20, 2026
Merged

pariterre merged 6 commits into
pyomeca:masterfrom
mickaelbegon:codex/ci-xdist-tests

Conversation

@mickaelbegon

@mickaelbegon mickaelbegon commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Run independent tests within each CI job using two pytest-xdist workers. Shards 3–6 use work stealing; shards 1–2 remain sequential because they share Acados output files and performance measurements respectively. Keep the full test selection and upstream CI event/draft policies.

The final diff only changes the two test workflows: install pytest-xdist, choose the worker count, pass the work-stealing options, and update checkout to v4. Scientific code, tests, numerical tolerances and public APIs are unchanged.

Hosted measurements

The completed Linux and Windows benchmarks compared fresh serial and two-worker pytest processes on GitHub-hosted four-CPU runners at 9a030ee96ac71a15f49960854b1936d500508a2e:

Shard Linux serial → parallel, coverage enabled Reduction Windows serial → parallel Reduction
3 566.02 → 325.98 s 42.4% 673.14 → 398.59 s 40.8%
4 622.99 → 412.47 s 33.8% 729.27 → 509.64 s 30.1%
5 450.46 → 289.11 s 35.8% 451.12 → 278.02 s 38.4%
6 606.46 → 488.80 s 19.4% 653.85 → 336.09 s 48.6%

Each mode ran the same 3,362 cases per OS, with identical outcomes: Linux 3,356 passed/6 skipped; Windows 3,338 passed/24 skipped; zero failures in either mode. All four Linux shards produced combined coverage without losing any sequentially covered lines.

These are one-pair per-shard measurements, serial first, not a total-CI speedup. The numerical environment was Python 3.14.8, biorbd 1.12.3, CasADi 3.7.2 and NumPy 2.5.4. Peak summed process RSS reached 10.9 GiB on Linux shard 5; this sum includes shared pages more than once. Two workers limit the additional memory pressure.

The temporary benchmark workflow and script were removed following review. Their source remains in the measured commit and their JUnit, coverage and timing evidence remains in the Linux/Windows artifacts of the linked run. They do not add a recurring benchmark to upstream CI or refer to a personal branch in the final diff. macOS benchmark execution is still queued.

Validation

Current head: ed170e61ed0f6151b1859524fd32a9beda11190a. Only the measurement tools were removed after the measured head; the two test workflows, scientific code and tests are unchanged by that cleanup.

  • All six Linux CI shards passed on the measured head. The four parallelized Windows shards passed both serial and parallel benchmark modes; the earlier full Windows CI also passed before the last workflow-only rebase.
  • Linux coverage merging and XML generation succeeded (78%). The fork's Codecov upload was rejected with Token required - not valid tokenless upload.
  • Upstream Black and qlty checks passed while draft; upstream tests were skipped because of draft status. Marking ready starts upstream Linux validation. macOS/Windows retain upstream's review-triggered policy.
  • After cleanup: actionlint, Black 26.5.1 on the full source tree (312 files unchanged), diff checks and 25 two-worker smoke tests passed. bioptim/ and tests/ remain identical to upstream master.

Refs #1085. Independent of the Conda-cache proposal #1116. Combining them requires adding pytest-xdist to the CI dependency specification and regenerating all three locks. Fork tracking PR: mickaelbegon#44.

All Submissions

  • Followed the contributing guidelines for this CI-only proposal.
  • Checked for existing open PRs covering the same change.
  • Linked the active issue: refs [CI] Evaluate and reduce GitHub Actions test runtime #1085.
  • Updated [WIP] to [RTR] after review cleanup and validation.
  • Pinged a maintainer when ready to merge — final CI/review remains outstanding; no reviewer ping posted.

New Feature Submissions

  • Complete upstream validation passed — Linux will run after ready; macOS/Windows remain subject to upstream review policy.
  • Described the behavior, measurements and limits.
  • Linted locally and ran the targeted two-worker smoke tests.

Changes to Core Features

  • Explained the purpose and final implementation.
  • Core examples: not applicable; no core feature or public API change.
  • Core numerical tests: unchanged; existing test selection retained.

This change is Reviewable

Comment thread .github/workflows/benchmark_xdist.yml Resolved
Comment thread .github/ci/benchmark_xdist.py Resolved
@mickaelbegon mickaelbegon changed the title [WIP] ci: run independent test shards with two pytest workers [RTR] ci: run independent test shards with two pytest workers Oct 15, 2026
@mickaelbegon
mickaelbegon marked this pull request as ready for review October 15, 2026 17:19
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.25%. Comparing base (19f3dbc) to head (89d43cc).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1117   +/-   ##
=======================================
  Coverage   78.25%   78.25%           
=======================================
  Files         198      198           
  Lines       21747    21747           
=======================================
+ Hits        17018    17019    +1     
+ Misses       4729     4728    -1     
Flag Coverage Δ
unittests 78.25% <ø> (+<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.

pariterre
pariterre previously approved these changes Oct 20, 2026

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@pariterre reviewed 5 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on mickaelbegon).

@pariterre
pariterre enabled auto-merge October 20, 2026 14:52
Updated precision for constraint checks in COLLOCATION case.

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pariterre reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on mickaelbegon).

@pariterre
pariterre disabled auto-merge October 20, 2026 15:18
@pariterre
pariterre enabled auto-merge October 20, 2026 15:19

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@pariterre made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on mickaelbegon).

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@pariterre made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on mickaelbegon).

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on mickaelbegon).

@Ipuch Ipuch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ipuch reviewed all commit messages and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on mickaelbegon).

@Ipuch Ipuch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@Ipuch made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on mickaelbegon).

@Ipuch Ipuch added CI Concerns only CI 15 minutes review A 15 minutes PR, including careful reading of the code by a human and revision guidelines. AI exploration labels Oct 20, 2026
@pariterre
pariterre merged commit 03a8047 into pyomeca:master Oct 20, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

15 minutes review A 15 minutes PR, including careful reading of the code by a human and revision guidelines. AI exploration CI Concerns only CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants