Repository navigation
fix(sharding): count work already on shards when choosing family span - #90
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
computeSpan estimated the busiest host as if the shards were empty, so a family with a cheap setup placed after others could land in full on one already loaded shard. The estimate now includes the load of the k least loaded shards, which matches what selectShards already counts. Fixes flakiness#89
miluoshi
force-pushed
the
fix/span-counts-shard-load
branch
from
November 24, 2026 12:25
f68043d to
6a08922
Compare
aslushnikov
approved these changes
Nov 27, 2026
| * - makespan >= family.work / K + family.setup | ||
| * Makespan is AT LEAST the chunk of work + a family setup. We might have a shard that | ||
| * has only this chunk of a family | ||
| * - makespan >= max(load(K), (load(1) + ... + load(K) + family.work) / K) |
| const total = estimateTotalWork(shards, [...families, heaviest]); | ||
| const missingSetups = shards.map(shard => missingSetup(shard, heaviest)).sort((a, b) => a - b); | ||
| // `load(i)` from the SALT comment, sorted from least to most loaded. | ||
| const hostLoads = shards.map(shard => shard.total + missingSetup(shard, heaviest)).sort((a, b) => a - b); |
Contributor
There was a problem hiding this comment.
can't we reuse missingSeutps defined on the previous line?
Test Results SummaryThis comment shows the latest test results for this pull request.
ℹ️ About Flakiness.io in GitHubYour team has set up Flakiness.io pull request comments. This comment is updated when
Flakiness.io rewrites the comment in place, so it always reflects the most recently tested commit. |
Contributor
|
@miluoshi thank you for the fix! |
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.
Fixes #89.
computeSpan()estimated the most loaded host assetup + work / k, as if the shards were empty. So when a family with a cheap setup was placed after others, all its tests could go to one shard that already had as much work as the rest. The estimate now adds the load of the k least loaded shards, the same wayselectShards()already countsshard.total. I also updated the SALT comment that describes this bound.The new test is the example from the issue: without the fix the shards get 211 / 110, with it 161 / 161.