Skip to content

Use worksteal distribution for parallel test runs - #2463

Draft
shangyian wants to merge 1 commit into
mainfrom
ci-worksteal-dist
Draft

Use worksteal distribution for parallel test runs#2463
shangyian wants to merge 1 commit into
mainfrom
ci-worksteal-dist

Conversation

@shangyian

Copy link
Copy Markdown
Collaborator

Summary

With --dist=loadscope, pytest-xdist pins every test in a module to a single worker. Our large test modules therefore become stragglers: they keep one worker busy long after the others have drained their queues, and the run can't finish until the slowest module does. --dist=worksteal instead lets idle workers steal pending tests from busy ones, so the tail of the run stays balanced.

Measured on the tests/api suite at -n 4: 304s -> ~250s, roughly 19% faster, with lower total CPU time as well. Three runs were stable and reported identical pass and skip counts.

The tradeoff is that worksteal makes no promise that all tests in a module run on the same worker, so any test that depends on state created by an earlier test in its module could start failing intermittently.

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

With --dist=loadscope, pytest-xdist pins every test in a module to a
single worker. Our large test modules therefore become stragglers: they
keep one worker busy long after the others have drained their queues,
and the run can't finish until the slowest module does. --dist=worksteal
instead lets idle workers steal pending tests from busy ones, so the
tail of the run stays balanced.

Measured on the tests/api suite at -n 4: 304s -> ~250s, roughly 19%
faster, with lower total CPU time as well. Three runs were stable and
reported identical pass and skip counts.

The tradeoff is that worksteal makes no promise that all tests in a
module run on the same worker, so any test that depends on state created
by an earlier test in its module could start failing intermittently. CI
on this branch is the check for that.
@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 345ac34
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6a8eda117417e60008d5841f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant