-
Notifications
You must be signed in to change notification settings - Fork 230
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
[Cache] Sort resourceUsages according to resourceName #907
[Cache] Sort resourceUsages according to resourceName #907
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
pkg/cache/cache_test.go
Outdated
if diff := cmp.Diff(tc.wantUsedResources, resources); diff != "" { | ||
t.Errorf("Unexpected used resources (-want,+got):\n%s", diff) | ||
} |
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.
Before I added sort, this tests failed:
$ go test -run 'TestClusterQueueUsage' ./pkg/cache/...
go: downloading k8s.io/apiextensions-apiserver v0.26.6
--- FAIL: TestClusterQueueUsage (0.01s)
--- FAIL: TestClusterQueueUsage/clusterQueue_without_cohort;_single_no_borrowing (0.01s)
cache_test.go:1490: Unexpected used resources (-want,+got):
[]v1beta1.FlavorUsage{
{Name: "default", Resources: {{Name: s"cpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_a", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_b", Resources: {{Name: s"example.com/gpu"}}},
{
Name: "interconnect_a",
Resources: []v1beta1.ResourceUsage{
+ {Name: s"example.com/vf-2", Total: resource.Quantity{Format: "DecimalSI"}},
{Name: s"example.com/vf-0"},
{Name: s"example.com/vf-1"},
- {Name: s"example.com/vf-2"},
},
},
}
cache_test.go:1490: Unexpected used resources (-want,+got):
[]v1beta1.FlavorUsage{
{Name: "default", Resources: {{Name: s"cpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_a", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_b", Resources: {{Name: s"example.com/gpu"}}},
{
Name: "interconnect_a",
Resources: []v1beta1.ResourceUsage{
- {Name: s"example.com/vf-0"},
{Name: s"example.com/vf-1"},
{Name: s"example.com/vf-2"},
+ {Name: s"example.com/vf-0", Total: resource.Quantity{Format: "DecimalSI"}},
},
},
}
cache_test.go:1490: Unexpected used resources (-want,+got):
[]v1beta1.FlavorUsage{
{Name: "default", Resources: {{Name: s"cpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_a", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_b", Resources: {{Name: s"example.com/gpu"}}},
{
Name: "interconnect_a",
Resources: []v1beta1.ResourceUsage{
+ {Name: s"example.com/vf-2", Total: resource.Quantity{Format: "DecimalSI"}},
{Name: s"example.com/vf-0"},
{Name: s"example.com/vf-1"},
- {Name: s"example.com/vf-2"},
},
},
}
--- FAIL: TestClusterQueueUsage/clusterQueue_with_cohort;_multiple_borrowing (0.00s)
cache_test.go:1490: Unexpected used resources (-want,+got):
[]v1beta1.FlavorUsage{
{Name: "default", Resources: {{Name: s"cpu", Total: {i: {...}, Format: "DecimalSI"}, Borrowed: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_a", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_b", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}, Borrowed: {i: {...}, Format: "DecimalSI"}}}},
{
Name: "interconnect_a",
Resources: []v1beta1.ResourceUsage{
- {Name: s"example.com/vf-0"},
{Name: s"example.com/vf-1"},
{Name: s"example.com/vf-2"},
+ {Name: s"example.com/vf-0", Total: resource.Quantity{Format: "DecimalSI"}},
},
},
}
cache_test.go:1490: Unexpected used resources (-want,+got):
[]v1beta1.FlavorUsage{
{Name: "default", Resources: {{Name: s"cpu", Total: {i: {...}, Format: "DecimalSI"}, Borrowed: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_a", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_b", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}, Borrowed: {i: {...}, Format: "DecimalSI"}}}},
{
Name: "interconnect_a",
Resources: []v1beta1.ResourceUsage{
+ {Name: s"example.com/vf-2", Total: resource.Quantity{Format: "DecimalSI"}},
{Name: s"example.com/vf-0"},
{Name: s"example.com/vf-1"},
- {Name: s"example.com/vf-2"},
},
},
}
--- FAIL: TestClusterQueueUsage/clusterQueue_without_cohort;_multiple_borrowing (0.00s)
cache_test.go:1490: Unexpected used resources (-want,+got):
[]v1beta1.FlavorUsage{
{Name: "default", Resources: {{Name: s"cpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_a", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{Name: "model_b", Resources: {{Name: s"example.com/gpu", Total: {i: {...}, Format: "DecimalSI"}}}},
{
Name: "interconnect_a",
Resources: []v1beta1.ResourceUsage{
+ {Name: s"example.com/vf-2", Total: resource.Quantity{Format: "DecimalSI"}},
{Name: s"example.com/vf-0"},
{Name: s"example.com/vf-1"},
- {Name: s"example.com/vf-2"},
},
},
}
FAIL
FAIL sigs.k8s.io/kueue/pkg/cache 0.640s
FAIL
/assign @alculquicondor |
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.
/approve
I would just remove the loops
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, 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 |
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
4524c0c
to
7131a1c
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.
/lgtm
let's cherry-pick as well. |
That's great! /cherrypick release-0.3 |
@tenzen-y: once the present PR merges, I will cherry-pick it on top of release-0.3 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/test-infra repository. |
@tenzen-y: #907 failed to apply on top of branch "release-0.3":
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/test-infra repository. |
…pstream-release-0.3 Automated cherry pick of #907: Sort resourceUsages according to resourceName
What type of PR is this?
/kind bug
What this PR does / why we need it:
The resourceUsages should be in a stable order to avoid endless creation of update events.
So, I added processes to sort resourceUsages according to resourceName in ClusterQueue and LocalQueue.
Which issue(s) this PR fixes:
Fixes #902
Special notes for your reviewer:
Does this PR introduce a user-facing change?