Skip to content

ci: Balance Tier 2 Linux shards by recorded test duration - #1049

Merged
zackees merged 2 commits into
masterfrom
ci/1048-tier2-shard-balance
Oct 16, 2026
Merged

zackees merged 2 commits into
masterfrom
ci/1048-tier2-shard-balance

Conversation

@zackees

@zackees zackees commented Oct 16, 2026

Copy link
Copy Markdown
Member

Fixes #1048. Part of #930 / #937.

ctest -I <i>,,3 striped tests by number: on master run 38874213546 the shards' test steps took 153 s (ON 3/3) against 63 s (OFF 2/3), and the slowest shard sets Tier 2's wall time.

  • rust/tools/linux-validate/shard-plan.sh (bash/awk, no Python in the container): longest test first, each into the lightest shard, using ctest's CTestCostData.txt format; no recorded cost means 1 s. It writes <i>-of-<n>.regex exact-name regexes.
  • Build stage (OBS_TIER2_SHARDS=3 in the workflow): ctest -N names + ctest-cost-<mode>.txt from the Tier 2 ccache (ci: Tier 2 Linux schedules slow tests first and runs 8 at a time (A3 of #930) #931) → <build>/tier2-shards/, packed with the tree.
  • Test stage: ctest -R with its shard's regex when the plan exists, else -I striping. run.sh passes OBS_TIER2_SHARDS.

Real ON cost data (260 tests): striping 49 / 73 / 154 s; balanced 92 / 92 / 92 s.

RED d04cbdf: ci/test_tier2_shard_plan.py. GREEN 35ca849: 7/7, ci/ suite green. A check caught that an empty cost file made every shard empty (awk FNR == NR misreads an empty first file); fixed, with a regression test.

Local end-to-end (Docker harness): build stage planned 255 tests into 91.9 s × 3 and packed the plan; a fresh volume with only the unpacked tree, shard 2/3, used the plan: 88 tests, 100% passed.

The cost data comes from runs before #975 (shards don't refresh it yet). It's still close, and a follow-up can have shards hand their timings back.

…1048)

Fails: shard-plan.sh does not exist and validate.sh stripes tests with
ctest -I.
ctest -I striped tests by number, so one shard ran tests for 153 s and
another for 63 s. shard-plan.sh assigns tests longest-first to the
lightest shard from ctest's cost data (in the Tier 2 ccache since #931);
the build job writes one exact-name regex per shard into the packed tree
(OBS_TIER2_SHARDS=3) and shards run ctest -R with it, striping only when
no plan exists. On the real ON cost data: 154 s -> 92 s slowest shard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ci: Balance Tier 2 Linux shards by recorded test duration

1 participant