-
Notifications
You must be signed in to change notification settings - Fork 213
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
Assigning the same flavor to codependent resources #296
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor 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 |
What's this pr fixes? |
Oops, wrong link. It should have been #167, but it's still WIP. |
b56c0c6
to
b9d3f55
Compare
456c9b4
to
7b716fa
Compare
4a90d5a
to
ec934c7
Compare
@kerthcet this is ready for review :D |
Some discussions under #308 (comment) |
rFlavor, borrow, status := findFlavorForResource(log, resName, reqVal, wUsed[resName], resourceFlavors, cq, &e.Obj.Spec.PodSets[i].Spec) | ||
assignedFlavors := make(map[corev1.ResourceName]string, len(podSet.Requests)) | ||
for resName := range podSet.Requests { | ||
if assignedFlavors[resName] != "" { |
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.
nit: add a comment explaining that this resource has been assigned a flavor while checking another resource with shared flavors.
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.
Done
pkg/scheduler/scheduler.go
Outdated
borrow, s := fitsFlavorLimits(name, val+wUsed[flavor.Name], cq, &flvLimit) | ||
if s.IsSuccess() { | ||
return flavor.Name, borrow, nil | ||
fitAll := true |
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.
fitAll := true | |
fitsAll := true |
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.
Done
for _, flvLimit := range cq.RequestableResources[name] { | ||
// Since all the resources share the same flavors, they use the same selector. | ||
selector := flavorSelector(spec, cq.LabelKeys[rName]) | ||
for i, flvLimit := range cq.RequestableResources[rName].Flavors { |
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 guess we were not favoring flavors that don't cause borrowing, we just follow the flavor order in CQ; with this change, doing that will get a little more complicated, but I think still doable (like check all flavors, and return the one that causes the minimum borrowing across dependent resources).
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.
That makes sense, except that different resources might have a different scale (cpus are expressed in milli, while gpu are scalar). Maybe we can simply look it as a percentage of the total request that is being borrowed.
Change-Id: I495a05c1ff5044e82996842c88f05f09eaa4605e
ec934c7
to
262d208
Compare
/lgtm hold just in case you are expecting more discussion on the PR, feel free to remove 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.
Oops, forgot to send my answers
rFlavor, borrow, status := findFlavorForResource(log, resName, reqVal, wUsed[resName], resourceFlavors, cq, &e.Obj.Spec.PodSets[i].Spec) | ||
assignedFlavors := make(map[corev1.ResourceName]string, len(podSet.Requests)) | ||
for resName := range podSet.Requests { | ||
if assignedFlavors[resName] != "" { |
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.
Done
for _, flvLimit := range cq.RequestableResources[name] { | ||
// Since all the resources share the same flavors, they use the same selector. | ||
selector := flavorSelector(spec, cq.LabelKeys[rName]) | ||
for i, flvLimit := range cq.RequestableResources[rName].Flavors { |
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.
That makes sense, except that different resources might have a different scale (cpus are expressed in milli, while gpu are scalar). Maybe we can simply look it as a percentage of the total request that is being borrowed.
pkg/scheduler/scheduler.go
Outdated
borrow, s := fitsFlavorLimits(name, val+wUsed[flavor.Name], cq, &flvLimit) | ||
if s.IsSuccess() { | ||
return flavor.Name, borrow, nil | ||
fitAll := true |
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.
Done
/hold cancel |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When adding a ClusterQueue to the cache, identify the resources that share the same list of flavors, which we call codependent.
When admitting, iterate through flavors, checking that all the codependent resources have enough quota for the flavor.
Which issue(s) this PR fixes:
Fixes #167
Special notes for your reviewer:
This assumes that #308 is implemented.