-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use hashing for targets list comparison and enable scheduler tests #11870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use hashing for targets list comparison and enable scheduler tests #11870
Conversation
There was a problem hiding this 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 refactors the way AssignGlobalRequestId
matches target lists by using hash-based comparison and re-enables previously skipped scheduler tests.
- Replaced sorting-based list comparison in
AssignGlobalRequestId
withComputeTargetsHash
andTargetsMatch
helpers - Adjusted early exit and new-ID assignment logic
- Enabled all scheduler unit tests by removing
[Fact(Skip=…)]
attributes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Build/BackEnd/Components/Scheduler/Scheduler.cs | Swapped list sorting for hash checks, added hashing/matching methods, and updated assignment logic |
src/Build.UnitTests/BackEnd/Scheduler_Tests.cs | Removed Skip on [Fact] attributes to enable scheduler tests |
Comments suppressed due to low confidence (2)
src/Build/BackEnd/Components/Scheduler/Scheduler.cs:2249
- The combined condition incorrectly reassigns a new GlobalRequestId even when one is already set. Consider first returning immediately if
GlobalRequestId
is already valid, then handling the case where there are no existing requests separately.
if (request.GlobalRequestId != BuildRequest.InvalidGlobalRequestId || _schedulingData.GetRequestsAssignedToConfigurationCount(request.ConfigurationId) == 0)
src/Build.UnitTests/BackEnd/Scheduler_Tests.cs:104
- The new
ComputeTargetsHash
andTargetsMatch
methods introduce order‐ and case‐agnostic comparisons that aren’t explicitly tested. Add unit tests covering varied target orders and casing to ensure correctness.
[Fact]
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Context
AssignGlobalRequestId is a critical method in Scheduler. This change attempts to optimize the scenario in it.
Changes Made
Switch from 2 string list comparison to hashset against the second list of strings.
Testing
Covered by existing tests.