mirror of
https://github.com/wassname/ray.git
synced 2026-07-06 05:16:30 +08:00
Split heartbeat message (#12535)
* first * xxx * Split heartbeat message * only report resource usage when changed * Fix GetAllResourceUsage * Fix report resource usage * Increase default heartbeat interval * regularize heartbeat interval in test case
This commit is contained in:
+11
-11
@@ -139,24 +139,24 @@ class Monitor:
|
||||
self.primary_subscribe_client.subscribe(channel)
|
||||
|
||||
def update_load_metrics(self):
|
||||
"""Fetches heartbeat data from GCS and updates load metrics."""
|
||||
"""Fetches resource usage data from GCS and updates load metrics."""
|
||||
|
||||
all_heartbeat = self.global_state_accessor.get_all_heartbeat()
|
||||
heartbeat_batch_data = \
|
||||
ray.gcs_utils.HeartbeatBatchTableData.FromString(all_heartbeat)
|
||||
for heartbeat_message in heartbeat_batch_data.batch:
|
||||
resource_load = dict(heartbeat_message.resource_load)
|
||||
total_resources = dict(heartbeat_message.resources_total)
|
||||
available_resources = dict(heartbeat_message.resources_available)
|
||||
all_resources = self.global_state_accessor.get_all_resource_usage()
|
||||
resources_batch_data = \
|
||||
ray.gcs_utils.ResourceUsageBatchData.FromString(all_resources)
|
||||
for resource_message in resources_batch_data.batch:
|
||||
resource_load = dict(resource_message.resource_load)
|
||||
total_resources = dict(resource_message.resources_total)
|
||||
available_resources = dict(resource_message.resources_available)
|
||||
|
||||
waiting_bundles, infeasible_bundles = parse_resource_demands(
|
||||
heartbeat_batch_data.resource_load_by_shape)
|
||||
resources_batch_data.resource_load_by_shape)
|
||||
|
||||
pending_placement_groups = list(
|
||||
heartbeat_batch_data.placement_group_load.placement_group_data)
|
||||
resources_batch_data.placement_group_load.placement_group_data)
|
||||
|
||||
# Update the load metrics for this raylet.
|
||||
node_id = ray.utils.binary_to_hex(heartbeat_message.node_id)
|
||||
node_id = ray.utils.binary_to_hex(resource_message.node_id)
|
||||
ip = self.raylet_id_to_ip_map.get(node_id)
|
||||
if ip:
|
||||
self.load_metrics.update(ip, total_resources,
|
||||
|
||||
Reference in New Issue
Block a user