-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Core][Node Labels 3/n]Add node labels to node resources and publish to all node #36009
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 |
---|---|---|
|
@@ -292,4 +292,15 @@ BundleLocationIndex &ClusterResourceManager::GetBundleLocationIndex() { | |
return bundle_location_index_; | ||
} | ||
|
||
void ClusterResourceManager::SetNodeLabels( | ||
const scheduling::NodeID &node_id, | ||
const absl::flat_hash_map<std::string, std::string> &labels) { | ||
auto it = nodes_.find(node_id); | ||
if (it == nodes_.end()) { | ||
NodeResources node_resources; | ||
it = nodes_.emplace(node_id, node_resources).first; | ||
} | ||
Comment on lines
+299
to
+302
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. it's a bit weird that we can have node with only labels but empty resources. We should be able to set labels and resources together when we add a node? 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. I have reconsidered and still think it's better to keep this interface. 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. I'm actually wondering when we may not have total resources. Should it be a check instead of warning? Let me check with the team. 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. Can we actually change 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. |
||
it->second.GetMutableLocalView()->labels = labels; | ||
} | ||
|
||
} // namespace ray |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,10 +44,11 @@ ClusterResourceScheduler::ClusterResourceScheduler( | |
const absl::flat_hash_map<std::string, double> &local_node_resources, | ||
std::function<bool(scheduling::NodeID)> is_node_available_fn, | ||
std::function<int64_t(void)> get_used_object_store_memory, | ||
std::function<bool(void)> get_pull_manager_at_capacity) | ||
std::function<bool(void)> get_pull_manager_at_capacity, | ||
const absl::flat_hash_map<std::string, std::string> &local_node_labels) | ||
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. Where is the change that creates the ClusterResourceScheduler and pass in the labels? 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. |
||
: local_node_id_(local_node_id), is_node_available_fn_(is_node_available_fn) { | ||
NodeResources node_resources = | ||
ResourceMapToNodeResources(local_node_resources, local_node_resources); | ||
NodeResources node_resources = ResourceMapToNodeResources( | ||
local_node_resources, local_node_resources, local_node_labels); | ||
Init(io_service, | ||
node_resources, | ||
get_used_object_store_memory, | ||
|
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.
After we have labels, the current naming (NodeResources) is no longer that accurate. We should probably have something like
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.
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.
Cool! Got the design.