-
Notifications
You must be signed in to change notification settings - Fork 972
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
resource compare support only consider the requested resource item #3522
Conversation
c495d5c
to
8a78264
Compare
2b27d71
to
1285f2e
Compare
Signed-off-by: lowang-bh <[email protected]>
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
ScalarResources: map[v1.ResourceName]float64{"nvidia.com/gpu": 1}, | ||
}, | ||
expected: 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.
Why this 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.
req need gpu resource with 1, and resource2 has no gpu, so it can not satisfy the request.
// LessEqualWithDimension only compare the resource items in req param | ||
// @param req define the resource item to be compared | ||
// if req is nil, equals r.LessEqual(rr, zero) | ||
func (r *Resource) LessEqualWithDimension(rr *Resource, req *Resource) bool { |
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.
How about just remove the dimensions not in req
of r
, then compare just like before?
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.
also ok.
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 think this way is more readable.
|
Signed-off-by: lowang-bh <[email protected]>
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
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hwdef 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 |
because lgtm has been added by @Monokaix |
fixes #3520
some times, we need to only compare the required dimensions in the resource.
eg: when check
Enqueueable
,Allocatable
orPreemptive
, even overused.Will use this function to replcae comparision in
AddJobEnqueueableFn
,AddPreemptiveFn
andAddAllocatableFn