Proposal: feat(capacity) parent-based reclaim#5111
Proposal: feat(capacity) parent-based reclaim#5111hajnalmt wants to merge 6 commits intovolcano-sh:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses issues with incorrect hierarchical reclaim behavior and unstable victim selection in parent-based reclaim scenarios. The changes ensure that victim selection consistently adheres to scheduler ordering semantics and respects parent-level resource deserving, thereby stabilizing reclaim decisions and preventing unintended preemption of borrowed capacity within a parent queue's quota. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces parent-based reclaim victim ordering in hierarchical capacity scheduling, addressing issue #5107. The changes involve updating documentation, modifying the session plugin to use a priority queue for victim selection, and implementing the core logic for parent-based reclaim in the capacity plugin. New test cases have been added to validate this functionality. However, a critical issue was identified in the reclaim logic where parent-level deserved checks are not consistently applied, potentially leading to incorrect reclaim decisions.
There was a problem hiding this comment.
Pull request overview
This PR fixes hierarchical capacity reclaim victim selection to respect configured victim ordering semantics (via BuildVictimsPriorityQueue) and adds parent-based deserved gating when parentBasedReclaimEnabled is enabled, along with corresponding tests and documentation updates.
Changes:
- Switch capacity reclaim victim iteration to consume candidates from
BuildVictimsPriorityQueueto stabilize and correct victim ordering. - Add optional parent-based deserved checks for cross-parent reclaim in hierarchical queues.
- Extend hierarchy tests to enable priority ordering and add parent-based reclaim scenarios; document the semantics in the design doc.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/scheduler/plugins/capacity/capacity_test.go | Enables priority ordering in tests and adds new parent-based reclaim test cases for deterministic victim selection. |
| pkg/scheduler/plugins/capacity/capacity.go | Implements queue parent tracking, parent-based reclaim gating, and uses the victims priority queue for reclaim ordering. |
| pkg/scheduler/framework/session_plugins.go | Adds job compare tie-breaker support and uses job/task compare functions to stabilize victim ordering. |
| docs/design/hierarchical-queue-on-capacity-plugin.md | Documents parentBasedReclaimEnabled semantics and parent-level deserved gating behavior in hierarchical reclaim. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…rder Apply plugin job CompareFn first in BuildVictimsPriorityQueue and use TaskOrderFn as the tie-breaker when job ordering is equal, including preemptor-missing paths, so creation timestamp does not dominate same-priority victim selection. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
Add BuildVictimsPriorityQueue unit coverage for job-order ties falling back to task-order, including preemptor-found and preemptor-missing paths. Place the test in package framework_test so it can use real plugin wiring without creating an import cycle between framework and plugin packages. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
1d309da to
9c1b0a7
Compare
9c1b0a7 to
d051903
Compare
Set deterministic PodGroup creation timestamps and assert JobOrderCompareFn tie conditions so task-order fallback behavior is validated consistently. Update BuildVictimsPriorityQueue comments to match current ordering paths, including orphaned jobs and queue-based handling. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
d051903 to
ab96b08
Compare
ab96b08 to
756bd20
Compare
756bd20 to
53c606d
Compare
prevent sibling leaf reclaim loops when parentBasedReclaimEnabled is true and both leaves under the same parent have no relevant deserved signal for the reclaimer request. keep parent-level reclaim semantics unchanged for cross-parent paths. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
53c606d to
bef2678
Compare
add Test_capacityPlugin_ParentBasedReclaimScenarios with case1-case5 coverage for parent-based reclaim behavior under hierarchy. restore Test_capacityPlugin_OnSessionOpenWithHierarchy to baseline scope and keep parent-based scenarios in a dedicated test suite. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
document case1-case5 from Test_capacityPlugin_ParentBasedReclaimScenarios with queue topology diagrams, workload details, and expected reclaim outcomes. reorder key-function section so updateParentQueue and note placement match the design structure. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
bef2678 to
0465ead
Compare
What type of PR is this?
/kind feature
/area scheduling
What this PR does / why we need it:
This PR adds parent-based reclaim configuration in the capacity plugin and keeps reclaim victim selection aligned with scheduler ordering semantics in hierarchical queue scenarios.
From design perspective only one shall be merged from:
It carries prerequisite victim-selection foundation commits so related scheduler tests pass reliably on this branch.
It also updates
ReclaimableFnvictim processing to useBuildVictimsPriorityQueue, aligning reclaim victim selection with scheduler victim-ordering semantics.Which issue(s) this PR fixes:
Fixes #5107
Special notes for your reviewer:
6200ee793— enhancement(victim selection): add job ordering tie-break with task order9d98e3a21— test(victim selection): add tie-break coverage in framework_test packagefdc34f9b3— test(victim selection): strengthen tie-break proof and update docsDoes this PR introduce a user-facing change?