mirror of
https://github.com/wassname/ray.git
synced 2026-07-08 15:28:06 +08:00
[Dashboard] displays resources row (#6516)
This commit is contained in:
committed by
Philipp Moritz
parent
840d9c126f
commit
166560e428
@@ -82,6 +82,8 @@ message ViewData {
|
||||
message NodeStatsReply {
|
||||
repeated WorkerStats workers_stats = 1;
|
||||
repeated ViewData view_data = 2;
|
||||
map<string, double> available_resources = 3;
|
||||
map<string, double> total_resources = 4;
|
||||
}
|
||||
|
||||
// Service for inter-node-manager communication.
|
||||
|
||||
@@ -2984,6 +2984,23 @@ void NodeManager::HandleNodeStatsRequest(const rpc::NodeStatsRequest &request,
|
||||
worker_stats->set_pid(driver->Pid());
|
||||
worker_stats->set_is_driver(true);
|
||||
}
|
||||
// Record available resources of this node.
|
||||
const auto &available_resources =
|
||||
cluster_resource_map_.at(client_id_).GetAvailableResources().GetResourceMap();
|
||||
// Record total resources of this node.
|
||||
const auto &total_resources =
|
||||
cluster_resource_map_.at(client_id_).GetTotalResources().GetResourceMap();
|
||||
auto available_resources_map = reply->mutable_available_resources();
|
||||
auto total_resources_map = reply->mutable_total_resources();
|
||||
for (const auto &pair : total_resources) {
|
||||
(*total_resources_map)[pair.first] = pair.second;
|
||||
auto it = available_resources.find(pair.first);
|
||||
if (it != available_resources.end()) {
|
||||
(*available_resources_map)[pair.first] = it->second;
|
||||
} else {
|
||||
(*available_resources_map)[pair.first] = 0.0;
|
||||
}
|
||||
}
|
||||
// Ensure we never report an empty set of metrics.
|
||||
if (!recorded_metrics_) {
|
||||
RecordMetrics();
|
||||
|
||||
Reference in New Issue
Block a user