feat(manager): support preheating by percentage#4053
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a percentage-based preheating feature by adding a Percentage field and updating related peer selection logic. Key changes include:
- Adding Percentage field to PreheatRequest, PreheatArgs, and related structures.
- Updating preheat logic to use new selectSeedPeers and selectPeers utilities for percentage-based selection.
- Propagating the Percentage field in the preheat workflow via updated utility methods and refactored control flow.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scheduler/job/job.go | Refactored seed and peer selection to implement percentage-based selection logic. |
| manager/types/job.go | Added the Percentage field with validation rules. |
| manager/job/preheat.go | Updated preheat functions to pass along the Percentage field. |
| internal/job/types.go | Added the Percentage field to the preheat request structure. |
Comments suppressed due to low confidence (1)
Signed-off-by: Gaius <gaius.qi@gmail.com>
CormickKneey
approved these changes
May 12, 2025
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4053 +/- ##
==========================================
- Coverage 34.40% 34.31% -0.10%
==========================================
Files 344 344
Lines 40299 40334 +35
==========================================
- Hits 13866 13841 -25
- Misses 25520 25575 +55
- Partials 913 918 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
yxxhero
approved these changes
May 12, 2025
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.
Description
This pull request introduces a new feature to support preheating a configurable percentage of peers or seed peers in the job scheduler. The changes include adding a
Percentagefield to relevant data structures, updating logic to handle percentage-based selection, and introducing utility methods for selecting peers based on the specified percentage.Feature: Percentage-based Preheating
Added
PercentageField to Data Structures:Percentagefield inPreheatRequestandPreheatArgsstructs to specify the percentage of peers or seed peers to preheat. This field is validated to accept values between 1 and 100. (internal/job/types.go[1]manager/types/job.go[2]Updated Preheat Logic:
Percentagefield into the preheat logic in methods likeCreatePreheatandparseLayers, ensuring the percentage value is passed through the workflow. (manager/job/preheat.go[1] [2]Implemented Peer Selection Utilities:
selectSeedPeersandselectPeersutility functions to select a subset of seed peers or peers based on the specified percentage. These methods ensure at least one peer is selected if the percentage is greater than zero. (scheduler/job/job.go[1] [2]Code Refactoring
Removed Redundant Checks:
preheatAllSeedPeersandpreheatAllPeers, replacing them with calls to the new peer selection utilities. (scheduler/job/job.go[1] [2]Updated Imports:
managerv2to support the updated logic. (scheduler/job/job.goscheduler/job/job.goR42)Related Issue
Motivation and Context
Screenshots (if appropriate)
Types of changes
Checklist