Repository navigation
Plan the Rest Python tests over parallel CI shards from recent timings - #10439
Merged
Merged
Conversation
The two chained Rest runners took about 130 minutes (run 40014592006), the longest path of every PR, after the core group grew to 50 minutes. RestPlan now reads the newest successful release run's JUnit and GNU time reports, splits groups longer than 25 minutes into time-balanced chunks, and deals them over 4-12 parallel shards. A process still runs files of one Makefile group only, in that group's order. Rest keeps the original check and fails unless the plan and every shard succeeded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The job runs no tests; it only fails unless the plan and every shard succeeded, so the old "Full Suite - Rest (Python + variables)" name suggested work it does not do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 24, 2026
MaxGhenis
added a commit
that referenced
this pull request
Oct 24, 2026
Takes #10439's Rest shard planner and drops this branch's move of heavy-a to shard 1, which the planner replaces. heavy-a keeps test_capital_gains_mtr_measurement.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What and why
PR CI's longest path is the Rest Python tests, which run on two chained runners. On run 40014592006 (#10416),
Full Suite - Rest (Python, shard-1 + variables)took 51 minutes, thenFull Suite - Rest (Python + variables)took 81 and finished 132 minutes in. Baseline → Contrib had finished at 68. The second runner's 81 minutes sit close to its 90-minute timeout. Thecoregroup alone takes 50 minutes; it took 12 on October 8. 27 of those minutes are one file,core/test_behavioral_response_measurement_copies.py(#9913).With the Enterprise runner capacity, this PR runs the Rest Python tests on parallel shards that balance themselves:
RestPlan(new, about a minute) downloads the JUnit and GNU time reports of the newest successful release run onmainand runspolicyengine_us/tests/rest_python_shards.py plan. The planner reads the groups from the Makefile's dry run and pytest's collection, splits any group longer than 25 minutes into time-balanced chunks, and deals processes longest-first over 4–12 shards, using the fewest that keep the longest near 25 minutes or the longest single process.RestPythonis a matrix of those shards (Full Suite - Rest (Python shard N)). Each runs its processes one after another, each with its own JUnit and GNU time report, and the variables YAML runs on the lightest shard.Rest(Check Rest Python shards, renamed fromFull Suite - Rest (Python + variables), which suggested it ran tests) runs no tests: it fails unless the plan and every shard succeeded.What stays the same:
test_rest_python_groups.pychecks that for plans made with no, measured, partly measured, skewed, tiny and huge times.make test-other-python-restruns every group in order, as before.Publishnow needing all three Rest jobs.As tests are added, each release run's reports rebalance the next plan. Long groups split on their own, and the shard count grows up to 12, so CI has no shard lists to maintain. Only successful release runs count, because a failed one can lack a lost runner's reports and skew the estimates. A file two reports cover (a re-run's leftover) counts once. Without reports (a fork, or expired artifacts), every file counts the same and the plan still runs every file once. A Makefile group option that a shard could not pass on to pytest, such as
-por--deselect, now fails the plan instead of being dropped.Expected effect
Plans from real reports:
This PR's first run, 40038526568, planned 5 shards from release run 40016344220:
core-2(the 27-minute file)remaining, variables YAMLcore-1,policy-parameterscached-arrays,heavy-a,policyheavy-b,core-heavy,remaining-heavyEvery Rest Python test finished 29 minutes after the plan started, instead of about 130 on two chained runners, which leaves Baseline → Contrib (about 70 minutes) as a PR's longest path. The shards used 119 runner-minutes, against 132 before. The floor is the 27-minute file, which gets a shard to itself; splitting it would be a separate change.
Runners per PR go from 27 to 27 plus the shard count (32 with today's 5 shards), at most 39. Runner-minutes stay about the same: the tests are unchanged, and each extra runner or process adds about 30 seconds of setup and 1.5 minutes of interpreter and model start.
Test plan
make formatchangelog.d/main);$()and backticks reach the shard intact;test_rest_python_groups.py,test_pr_runner_budget.py,test_make_test_matches_ci.py,test_pr_workflow_skips_drafts.py): 72 passed;rest_python_shards.py run.main's file for file:test_rest_python_groups.py;test_batched.py(the YAML batch runner, collected for its name) has no tests in either layout.#10400, #10401 and #10058 also edit the Makefile's Rest comments or
test_rest_python_groups.py. Their changes work with the planner, which reads whatever groups and ignores the Makefile defines. Whichever merges second has a small text conflict to resolve.axiom: n/a: CI scheduling and workflow guard changes only.
🤖 Generated with Claude Code