Skip to content

Split aware xdist scheduler#3446

Merged
mkoura merged 3 commits intomasterfrom
split_aware_xdist_scheduler
May 5, 2026
Merged

Split aware xdist scheduler#3446
mkoura merged 3 commits intomasterfrom
split_aware_xdist_scheduler

Conversation

@mkoura
Copy link
Copy Markdown
Collaborator

@mkoura mkoura commented May 5, 2026

No description provided.

mkoura added 3 commits May 5, 2026 14:58
Tests that lock heavy shared resources (e.g. governance) can now
be marked with `@pytest.mark.xdist_split("<key>")`. Unlike
`xdist_group`, split tests are NOT grouped onto one worker; each
gets its own per-test scope and the scheduler caps the number of
in-flight tests sharing a key at the cluster instance capacity
(CLUSTERS_COUNT env, falling back to xdist worker count bounded
by 9). A test locking multiple resources can declare several
keys at once via a comma-separated value, e.g.
`xdist_split("governance,plutus")`; the cap applies independently
per key.

Without the cap, when many same-key tests are collected together
xdist hands them out at once to many workers; workers beyond the
instance capacity then sit blocked in the cluster manager waiting
for the shared resource to free up, instead of running unrelated
non-conflicting tests that could share those same instances in
parallel.
Apply the new split-key dispersion to conway governance tests so
they get spread across xdist workers instead of piling up behind
each other on the same cluster instances.
Apply split-key dispersion to the upgrade-step plutus_v3 test
that contends for governance cluster resources.
@mkoura mkoura requested a review from saratomaz as a code owner May 5, 2026 13:00
@mkoura mkoura requested a review from Copilot May 5, 2026 13:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the repository’s custom pytest-xdist scheduler to support a new “split” concept for tests that contend on heavyweight shared resources (e.g., governance setup). It introduces an xdist_split marker that lets those tests be dispersed across workers while capping concurrent in-flight tests per split key to the available cluster-instance capacity, avoiding mass worker stalls.

Changes:

  • Added two pytest markers: xdist_group (group onto one worker) and xdist_split (spread across workers with concurrency cap).
  • Enhanced the custom xdist scheduler to (1) keep long-test balancing and (2) avoid overscheduling tests sharing the same split key beyond cluster capacity.
  • Annotated several governance-/plutus-heavy tests with @pytest.mark.xdist_split(...) to enable the new scheduling behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Registers xdist_group / xdist_split markers to avoid unknown-marker warnings and document intent.
cardano_node_tests/pytest_plugins/xdist_scheduler.py Implements split-key parsing, per-key in-flight caps, and integrates this into scheduling decisions.
cardano_node_tests/tests/tests_plutus_v3/test_mint_build.py Marks a heavy test with xdist_split("governance").
cardano_node_tests/tests/tests_conway/test_update_plutusv2_builtins.py Marks a heavy test with xdist_split("governance,plutus").
cardano_node_tests/tests/tests_conway/test_pparam_update.py Marks a heavy test with xdist_split("governance,plutus").
cardano_node_tests/tests/tests_conway/test_no_confidence.py Marks heavy governance tests with xdist_split("governance").
cardano_node_tests/tests/tests_conway/test_hardfork.py Marks the hardfork test with xdist_split("governance").
cardano_node_tests/tests/tests_conway/test_guardrails.py Marks guardrails test with xdist_split("governance").
cardano_node_tests/tests/tests_conway/test_drep.py Marks DRep inactivity test with xdist_split("governance").
cardano_node_tests/tests/tests_conway/test_constitution.py Marks constitution change test with xdist_split("governance").
cardano_node_tests/tests/tests_conway/test_committee.py Marks multiple committee-related heavy tests with xdist_split("governance").

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mkoura mkoura merged commit f307d5a into master May 5, 2026
7 checks passed
@mkoura mkoura deleted the split_aware_xdist_scheduler branch May 5, 2026 14:27
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.

2 participants