test_bot: avoid unbalanced shard#23023
Merged
Merged
Conversation
When there is a commonly used dependent, one group can end up with a majority or tested dependents and result in unbalanced shard. As naive fix, limit the group size to balanced size and defer handling of remaining dependents in queue to later iterations of loop.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts test_bot’s formula dependents sharding logic to reduce the chance that a single highly-connected dependent group dominates a shard, leading to unbalanced workloads in CI.
Changes:
- Switch
seentracking from an array to aSetwhen building dependent groups. - Cap the size of each discovered dependent group to a computed
max_group_sizebefore assigning groups to shards.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?When there is a commonly used dependent, one group can end up with a majority or tested dependents and result in unbalanced shard.
As naive fix, limit the group size to balanced size and defer handling of remaining dependents in queue to later iterations of loop.
For now, mainly trying to see if we can get something usable in Homebrew/core.
There are likely better ways to improve sharding in future. Clustering around the most similar dependency trees could be better at reusing cached downloads
Alternatively, I wonder if there is a noticeable difference from the most basic sorted split into 4 groups. This at least is better at minimizing impact of possible race conditions (e.g. a PR getting merged in between CI runners can lead to a different sharding which can cause dependents to be skipped).