-
Notifications
You must be signed in to change notification settings - Fork 7k
[Core][GPU fraction][1/n] Unify node feasibility and availability checking #59278
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,9 +19,7 @@ namespace raylet_scheduling_policy { | |||||||||||||
|
|
||||||||||||||
| double LeastResourceScorer::Score(const ResourceRequest &required_resources, | ||||||||||||||
| const NodeResources &node_resources) { | ||||||||||||||
| // Check if the node has required labels before scoring on the resources. | ||||||||||||||
| const auto &label_selector = required_resources.GetLabelSelector(); | ||||||||||||||
| if (!node_resources.HasRequiredLabels(label_selector)) { | ||||||||||||||
| if (!node_resources.IsAvailable(required_resources)) { | ||||||||||||||
| return -1.; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -42,22 +40,16 @@ double LeastResourceScorer::Score(const ResourceRequest &required_resources, | |||||||||||||
| for (auto &resource_id : required_resources.ResourceIds()) { | ||||||||||||||
| const auto &request_resource = required_resources.Get(resource_id); | ||||||||||||||
| const auto &node_available_resource = node_resources_ptr->available.Get(resource_id); | ||||||||||||||
| auto score = Calculate(request_resource, node_available_resource); | ||||||||||||||
| if (score < 0.) { | ||||||||||||||
| return -1.; | ||||||||||||||
| } | ||||||||||||||
| node_score += score; | ||||||||||||||
| node_score += Calculate(request_resource, node_available_resource); | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my understanding of the code:
I might miss something but looks like with the new implementation, there could be case where the node will have available resources before the resource update but not after which will make the new implementation not consistent with the previous implementation, is that right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry about that — I should have mentioned this!
ray/src/ray/common/scheduling/cluster_resource_data.cc Lines 98 to 103 in de7ac7d
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. I missed that. Thanks for the context! The current implementation is a bit confusion, as part of the project of improving the resource tracking effort, we should make it cleaner.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I will look deep into it and draft an follow up pr if needed! |
||||||||||||||
| } | ||||||||||||||
| return node_score; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // This function assumes the resource request has already passed the availability check | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Can you add the this also to the comment of the function in the .h file?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added, Thank you! |
||||||||||||||
| double LeastResourceScorer::Calculate(const FixedPoint &requested, | ||||||||||||||
| const FixedPoint &available) { | ||||||||||||||
| RAY_CHECK(available >= 0) << "Available resource " << available.Double() | ||||||||||||||
| << " should be nonnegative."; | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of the
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need. From a design perspective, the logic for determining whether a node is schedulable and the logic for choosing the best node should be completely separate and follow a strict order. |
||||||||||||||
| if (requested > available) { | ||||||||||||||
| return -1; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (available == 0) { | ||||||||||||||
| return 0; | ||||||||||||||
|
|
||||||||||||||
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.
IsAvailablealready checks the required labels.