-
Notifications
You must be signed in to change notification settings - Fork 299
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
Refactor computation of TAS assignments #4200
Refactor computation of TAS assignments #4200
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
@mimowo: GitHub didn't allow me to request PR reviews from the following users: PTAL. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
657c694
to
9a1a04e
Compare
Rebased after #4204 was merged |
9a1a04e
to
aefc10a
Compare
@@ -223,6 +223,56 @@ func (s *TASFlavorSnapshot) addTASUsage(domainID utiltas.TopologyDomainID, usage | |||
s.leaves[domainID].tasUsage.Add(usage) | |||
} | |||
|
|||
type TASPodSetRequests 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.
Is there a need to introduce a new type if we already have a similar one PodSetResources
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.
Good point, there is no strict need, we could think about consolidating them, but there are subtle differences:
- PodSetResources.Requests is the aggregated requests while TASPodSetRequests.SinglePodRequests is per pod
- PodSetResources.Flavors is a resource -> Flavor map while for TAS we can have only one flavor per PodSet
So the question, how would we reconcile that? Should PodSetResources
, some ideas for (1.):
- make the
PodSetResources
to internally keep SinglePodRequests and have a function with TotalRequests - keep both
SinglePodRequests
andTotalRequets
redudantly - make
PodSetResources
keep total requests internally and deriveSinglePodRequests
in a function
I think for (2.) it is quite straighforward that we would fit into the "Flavors" field, and just have a helper function OnlyFlavor which would be called in the TAS context.
WDYT? I'm ok to make the changes in this PR or in a follow up.
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.
keep both SinglePodRequests and TotalRequets redudantly
Do we really need this? I guess single pod requests can be represented as TotalRequest[idx].Requests / TotalRequest[idx].Count
?
Is there a reason why we prepare just the helper function? I can imagine the number of TotalRequest
is smaller since it indicates the number of PodSet. At most, it is 4 like (pre-processing, driver, worker, post-processing).
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 really need this?
I don't think so, it is one of the options in my previous comment. Other options I mentioned is to keep only one field and derive the other (by dividing or multiplication) in a function. I'm ok with either approach.
I can give it a try today in this PR, but if I encounter issues I would prefer to leave it for follow up to unblock the functional PRs (which is still preemption within ClusterQueue and cohort support).
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.
SGTM
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.
I can give it a try today in this PR, but if I encounter issues I would prefer to leave it for follow up to unblock the functional PRs (which is still preemption within ClusterQueue and cohort support).
Separate PR sounds good to me.
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.
I just realized there is one more complication: PodSetResources
does not reference kueue.PodSet
, I add it in TASPodSetRequests
as ptr. This is needed for example as input with tolerations for the algorithm. So, I think we would need to also extend PodSetResources
with *kueue.PodSet
.
I'm for it, but indeed prefer a follow up,
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.
Added the refactoring to the tracking spreadsheet as "commonize the structures for PodSetResources and TASPodSetRequests"
aefc10a
to
103dcab
Compare
} | ||
|
||
if features.Enabled(features.TopologyAwareScheduling) { | ||
tasRequests := assignment.TopologyRequestsFor(a.wl, requests, a.cq) |
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.
WDYT about calling this function inside a.cq.FindTopologyAssignments
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.
not so simple, because it needs access to the assignment
to update it which is the receiver. Unless we refactor stuff somehow, but I'm not sure how.
9424b31
to
0b928c4
Compare
0b928c4
to
89290b1
Compare
89290b1
to
70517e2
Compare
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.
Thank you!
/approve
/lgtm
/hold for @PBundyra
return nil, err | ||
} | ||
if cq.TASFlavors[*tasFlvr] == nil { | ||
return nil, errors.New("workload requires Topology, but there is no TAS cache information for the assigned flavor") |
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.
Here, let us implement UTs similar to above. I will add this followup list issue.
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.
Added to the tracking spreadsheet
// clear flavors to make the PodSet assignment as NoFit | ||
psAssignment.Flavors = nil | ||
// update the representative mode accordingly | ||
assignment.representativeMode = ptr.To(NoFit) |
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.
Oh, you already have addressed, thanks!
LGTM label has been added. Git tree hash: dbe54bd4c15a267e6666b7a591c9f1eb48a7a9ea
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mimowo, tenzen-y 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 |
I believe all comments are either addressed on added to the tracking spreadsheet. I will work on them in follow ups unless other contributors want to help. |
In case of having an agreement with @PBundyra, I'm ok with upholding it. Idk the relationship between you and Patryk in your team, though |
Thanks, let's wait for Patryk :)
We are team mates, desk to desk :) |
Sounds great :) |
/unhold Thanks for waiting for me :) |
* Refactor computation of TAS assignments * review remarks
/cherry-pick release-0.10 Preparing for #4322 |
@tenzen-y: #4200 failed to apply on top of branch "release-0.10":
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. |
/cherry-pick release-0.10 |
@tenzen-y: new pull request created: #4327 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. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Part of #3761
Preparatory for #4171
Special notes for your reviewer:
The main change in this PR is to refactor how the TAS assignment is computed when there are multiple PodSets. Previously the usage from previous podsets was already accounted regardless of the final scheduling result, see here. This works well only assuming the FindTopologyAssignment function is called once.
However, to support preemptions I will need to run this function multiple times for a different set of target workloads. Similarly, this assumption is also invalid for cohorts.
So I introduce a concept of
assumedUsage
which is tracked within one FindTopologyAssignment called across all PodSets targeting a flavor, see here.This change also improves the error message, which I extracted to yet another preparatory PR: #4204, so that we can decide about cherry-picking independently.
Does this PR introduce a user-facing change?