Proposal: feat(capacity) ancestor reclaim level#5115
Proposal: feat(capacity) ancestor reclaim level#5115hajnalmt wants to merge 5 commits intovolcano-sh:masterfrom
Conversation
…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>
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>
Add ancestorReclaimLevel configuration to support ancestor-based reclaim scenarios across hierarchical queues. Enable child queues to reclaim borrowed resources through configured ancestor levels and add hierarchical level-1 and unbalanced level-2 regression coverage. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
Document ancestorReclaimLevel configuration and explain reclaim behavior across sibling, cousin, and deeper ancestor relationships in hierarchical queues. Signed-off-by: Hajnal Máté <hajnalmt@gmail.com>
|
[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 significantly enhances the resource reclaim capabilities within the capacity plugin for hierarchical queues. It provides operators with finer-grained control over reclaim boundaries by introducing an 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
Activity
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.
Pull request overview
This PR adds ancestorReclaimLevel configuration to the capacity plugin, enabling ancestor-based deserved checks during hierarchical queue reclaim. It also refactors victim selection to use BuildVictimsPriorityQueue and improves job-order tie-breaking with task order.
Changes:
- Add
ancestorReclaimLevelargument to capacity plugin controlling how many ancestor levels are checked before cross-hierarchy reclaim is allowed - Refactor
BuildVictimsPriorityQueueto useJobOrderCompareFnwith task-order tie-breaking, and use it inReclaimableFn - Add tests for ancestor reclaim levels 0/1/2 and unbalanced hierarchy, plus documentation updates
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/scheduler/plugins/capacity/capacity.go | Add ancestorReclaimLevel field, argument parsing, ancestor checks in ReclaimableFn and PreemptiveFn |
| pkg/scheduler/framework/session_plugins.go | Extract JobOrderCompareFn, add task-order tie-break in BuildVictimsPriorityQueue |
| pkg/scheduler/framework/session_plugins_victim_order_test.go | Test coverage for victim priority queue tie-breaking |
| pkg/scheduler/plugins/capacity/capacity_test.go | Test cases for ancestor reclaim levels and unbalanced hierarchy |
| docs/user-guide/how_to_use_capacity_plugin.md | Document ancestorReclaimLevel usage |
| docs/design/hierarchical-queue-on-capacity-plugin.md | Document reclaim scope control design |
💡 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.
| # 1: only queues with the same parent | ||
| # 2: also allows same grandparent (and so on for larger values) |
|
|
||
| Interaction examples in a hierarchy: | ||
|
|
||
| - Siblings (same direct parent): reclaim is decided by leaf queue checks, and when `ancestorReclaimLevel >= 1`, parent-level deserved checks are also applied when siblings cross parent boundaries in deeper trees. |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and valuable feature, ancestorReclaimLevel, to provide more granular control over resource reclamation in hierarchical queues. The changes are well-structured, encompassing logic modifications in the capacity plugin, refactoring of core scheduler functions for better victim selection, comprehensive new test cases, and updated documentation. The implementation appears solid and the added tests provide good coverage for the new functionality. My feedback primarily focuses on improving the clarity and accuracy of the documentation to ensure users can correctly understand and utilize this new feature.
|
|
||
| Interaction examples in a hierarchy: | ||
|
|
||
| - Siblings (same direct parent): reclaim is decided by leaf queue checks, and when `ancestorReclaimLevel >= 1`, parent-level deserved checks are also applied when siblings cross parent boundaries in deeper trees. |
There was a problem hiding this comment.
The description for sibling reclaim could be clearer. By definition, siblings share the same direct parent, so they cannot "cross parent boundaries". The parent-level check is skipped for them because they have a common parent at level=1. The current phrasing might cause confusion.
| - Siblings (same direct parent): reclaim is decided by leaf queue checks, and when `ancestorReclaimLevel >= 1`, parent-level deserved checks are also applied when siblings cross parent boundaries in deeper trees. | |
| - Siblings (same direct parent): Reclaim is primarily decided by leaf-queue deserved checks. The ancestor check at `level=1` is skipped because they share the same parent. |
| arguments: | ||
| # Controls how far reclaim can cross queue hierarchy boundaries. | ||
| # 0: no ancestor restriction (default behavior) | ||
| # 1: only queues with the same parent |
There was a problem hiding this comment.
The comment for ancestorReclaimLevel: 1 is misleading. It states it's for "only queues with the same parent", which implies it only affects siblings. However, this setting primarily controls cross-parent (e.g., cousin) reclaim by adding a parent-level deserved check.
| # 1: only queues with the same parent | |
| # 1: adds parent-level deserved checks for cross-parent reclaim (e.g., between cousins). |
What type of PR is this?
/kind feature
/area scheduling
What this PR does / why we need it:
This PR mainly ports and adapts #5111 from parent-based reclaim semantics to
ancestorReclaimLevelin the capacity plugin.From design perspective only one shall be merged from:
This PR adds
ancestorReclaimLevelconfiguration to support ancestor-based reclaim behavior in hierarchical queues, so child queues can reclaim borrowed resources through configured parent/grandparent ancestor constraints.It also updates
ReclaimableFnvictim processing to useBuildVictimsPriorityQueue, aligning reclaim victim selection with scheduler victim-ordering semantics.Additionally, it adapts hierarchical reclaim test scenarios to run with
ancestorReclaimLevel=1, adds unbalanced level-2 regression coverage, and updates documentation for sibling/cousin/second-cousin reclaim interactions.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 docs64b637277216281582Volcano wakes where hot clouds swirl,
Queues reclaim in a steady curl;
Ancestors guide the fairness flow,
So borrowed sparks return and glow.
Does this PR introduce a user-facing change?