-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[Core][Label scheduling 3/n] Implement node label scheduling strategy #37339
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
Conversation
819e95a
to
e8fa814
Compare
e8fa814
to
4088418
Compare
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
const auto &soft_expressions = node_label_scheduling_strategy.soft(); | ||
if (soft_expressions.expressions().size() > 0) { | ||
// soft match | ||
auto match_count_map = ScoreNodesBySoftExpressions(candidate_nodes, soft_expressions); |
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 don't think we need to score soft match: you either match the entire expressions or not. There is no partial match. We only need to score after we support OR with weights.
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.
It's okay. We can add it if necessary in the future.
4088418
to
0ddeee6
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.
Will continue.
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
@@ -132,6 +136,9 @@ struct hash<ray::rpc::SchedulingStrategy> { | |||
hash ^= | |||
static_cast<size_t>(scheduling_strategy.placement_group_scheduling_strategy() | |||
.placement_group_capture_child_tasks()); | |||
} else if (scheduling_strategy.has_node_label_scheduling_strategy()) { | |||
hash ^= std::hash<std::string>()( | |||
scheduling_strategy.node_label_scheduling_strategy().DebugString()); |
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.
SerializeAsString as well?
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.
The hash function should guarantee that if two label scheduling strategies are the same, they must have the same hash value. Can we actually examine each field of NodeLabelSchedulingStrategy
like what we do for other scheduling strategies?
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.
Let's at least change to SerializeAsString for now.
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.
Because SerializeAsString
is unsafe for hash. I think just use DebugString for now.
0ddeee6
to
25ce51f
Compare
@@ -132,6 +136,9 @@ struct hash<ray::rpc::SchedulingStrategy> { | |||
hash ^= | |||
static_cast<size_t>(scheduling_strategy.placement_group_scheduling_strategy() | |||
.placement_group_capture_child_tasks()); | |||
} else if (scheduling_strategy.has_node_label_scheduling_strategy()) { | |||
hash ^= std::hash<std::string>()( | |||
scheduling_strategy.node_label_scheduling_strategy().DebugString()); |
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.
The hash function should guarantee that if two label scheduling strategies are the same, they must have the same hash value. Can we actually examine each field of NodeLabelSchedulingStrategy
like what we do for other scheduling strategies?
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
25ce51f
to
c8c71fa
Compare
That's fine. I'd prefer to create a new PR for this modification. The struct has quite a few member variables, so the code will be substantial. I'll also write some test cases. |
@@ -132,6 +136,9 @@ struct hash<ray::rpc::SchedulingStrategy> { | |||
hash ^= | |||
static_cast<size_t>(scheduling_strategy.placement_group_scheduling_strategy() | |||
.placement_group_capture_child_tasks()); | |||
} else if (scheduling_strategy.has_node_label_scheduling_strategy()) { | |||
hash ^= std::hash<std::string>()( | |||
scheduling_strategy.node_label_scheduling_strategy().DebugString()); |
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.
Let's at least change to SerializeAsString for now.
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
src/ray/raylet/scheduling/policy/node_label_scheduling_policy.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: 稚鱼 <554538252@qq.com> Signed-off-by: LarryLian <554538252@qq.com>
c8c71fa
to
e367a4b
Compare
…ray-project#37339) Signed-off-by: LarryLian <554538252@qq.com> Signed-off-by: NripeshN <nn2012@hw.ac.uk>
…ray-project#37339) Signed-off-by: LarryLian <554538252@qq.com> Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
…ray-project#37339) Signed-off-by: LarryLian <554538252@qq.com> Signed-off-by: Victor <vctr.y.m@example.com>
Why are these changes needed?
Implement node label scheduling strategy
Related issue number
#34894
(P2)Implement the node affinity with labels interface in Python and transparently transmit it to the CoreWorker.
(P2)Implement the node affinity with labels scheduling policy.
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.