-
Notifications
You must be signed in to change notification settings - Fork 479
Prefer Reclamation over Priority Based Preemption #2811
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
Prefer Reclamation over Priority Based Preemption #2811
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
b65cfb3 to
3d87d6f
Compare
|
/assign @PBundyra |
mimowo
left a comment
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.
LGTM, it is quite impressive how small the fix is. I'm wondering if we have enough test coverage for the oracle though.
| } | ||
|
|
||
| // granularMode is the FlavorAssignmentMode internal to | ||
| // FlavorAssigner, which lets us distinguish priority based premption, |
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.
| // FlavorAssigner, which lets us distinguish priority based premption, | |
| // FlavorAssigner, which lets us distinguish priority based preemption, |
|
|
||
| for _, candidate := range p.preemptor.getTargets(log, wl, resources.FlavorResourceQuantities{fr: quantity}, sets.New(fr), p.snapshot) { | ||
| if candidate.WorkloadInfo.ClusterQueue == cq.Name { | ||
| return false |
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.
Do we have any test which exercises if this is needed? If no, it would be good to have it.
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.
Missed this, thank you. Added a test which covers this path.
| wantPreempted: sets.New("eng-beta/b1"), | ||
| wantLeft: map[string][]string{ | ||
| "other-alpha": {"eng-alpha/preemptor"}, | ||
| }, |
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.
Since eng-alpha/a1 has lower priority than eng-alpha/preemptor shouldn't a1 be preempted, and preemptor be admitted?
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.
preemptor will be admitted - but in a future cycle (the way these tests are setup, we expect to see it in wantLeft, since it didnt Fit this cycle). It was correct here to preempt b1, as we have a preference (after this PR) to reclaim capacity, rather than preempt another workload in the same CQ.
|
When reclamation meets required quota only partially, do we still reclaim as much as possible and then preempt the rest, or do we just preempt the whole missing quota? |
3d87d6f to
ca32567
Compare
Yes, we will preempt the workloads which reclaim capacity first. But, it is possible we won't end up preempting them if we can get all the resources we need from a workload in our CQ, as we attempt to add back workloads after the fit - the step here |
| "prefer first preemption flavor when second flavor requires both reclaim and cq priority preemption": { | ||
| // Flavor 1, on-demand, requires preemption of workload in CQ. | ||
| // Flavor 2, spot, requires preemption of workload in Cohort and CQ | ||
| // Since Flavor 2 doesn't improve the assignment, we prefer Flavor 1. |
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.
Thanks for the descriptions. They are really helpful here.
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gabesaba, mimowo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
LGTM @mimowo |
|
/lgtm |
|
LGTM label has been added. Git tree hash: f72ab35e2c72db45ec2b5f37802c4721cb01dc69
|
|
/cherry-pick release-0.8 |
|
@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.8 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@mimowo: #2811 failed to apply on top of branch "release-0.8": In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@gabesaba PTAL what is the best way to backport it. |
* Cleanup to use FlavorResourceQuantities.Add in cache (#2696) * fix: Refactor FitInCohort tests (#2655) * fix: Refactor FitInCohorot tests * fix: delete no-op function * fix: use new method to add usage * fix: to enforce resource group constraint for flavors and resources * fix: consolidated into a single resource group * fix: delete flavorNames * fix: adjusted test cases to align with existing expected conditions * fix: change FlavorResourceQuantitiesFlat value * Finish flattening of FlavorResourceQuantities (#2721) * Finish Flattenning FlavorResourceQuantities * Rename FlavorResourceQuantitiesFlat to FlavorResourceQuantities * Cleanup preemption.go (#2800) * [Partial Admission] Check Mode before attempting Preemption (#2809) * Prefer Reclamation to Priority Based Preemption (#2811) --------- Co-authored-by: s-shiraki <[email protected]>
| @@ -0,0 +1,35 @@ | |||
| package preemption | |||
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.
Add copyright
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.
| usage resources.FlavorResourceQuantities | ||
| } | ||
|
|
||
| type testOracle struct{} |
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.
why add this, as opposed to use the real object (or not have an intermediary object at all)?
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.
dependency graph - preemption depends on flavor assigner, and refactoring was non-trivial
What type of PR is this?
/kind bug
What this PR does / why we need it:
We update
FlavorSelectorto simulate preemption, to determine if a workload can reclaim capacity from its Cohort in one Flavor, rather than preempting its workloads in another Flavor. This matches behavior in the single Flavor case, where a ClusterQueue prioritizes preempting workloads in its Cohort, before preempting its own workloads.Which issue(s) this PR fixes:
Fixes #2720
Special notes for your reviewer:
Does this PR introduce a user-facing change?