Remove local/global_scheduler from code and doc. (#4549)

This commit is contained in:
Yuhong Guo
2019-04-03 17:05:09 -07:00
committed by Philipp Moritz
parent 51dae23d5c
commit c2349cf12d
29 changed files with 177 additions and 204 deletions
+16 -17
View File
@@ -48,9 +48,9 @@ class Monitor(object):
# Setup subscriptions to the primary Redis server and the Redis shards.
self.primary_subscribe_client = self.redis.pubsub(
ignore_subscribe_messages=True)
# Keep a mapping from local scheduler client ID to IP address to use
# Keep a mapping from raylet client ID to IP address to use
# for updating the load metrics.
self.local_scheduler_id_to_ip_map = {}
self.raylet_id_to_ip_map = {}
self.load_metrics = LoadMetrics()
if autoscaling_config:
self.autoscaler = StandardAutoscaler(autoscaling_config,
@@ -126,9 +126,9 @@ class Monitor(object):
static_resources[static] = (
heartbeat_message.ResourcesTotalCapacity(i))
# Update the load metrics for this local scheduler.
# Update the load metrics for this raylet.
client_id = ray.utils.binary_to_hex(heartbeat_message.ClientId())
ip = self.local_scheduler_id_to_ip_map.get(client_id)
ip = self.raylet_id_to_ip_map.get(client_id)
if ip:
self.load_metrics.update(ip, static_resources,
dynamic_resources)
@@ -243,7 +243,7 @@ class Monitor(object):
# Determine the appropriate message handler.
if channel == ray.gcs_utils.XRAY_HEARTBEAT_BATCH_CHANNEL:
# Similar functionality as local scheduler info channel
# Similar functionality as raylet info channel
message_handler = self.xray_heartbeat_batch_handler
elif channel == ray.gcs_utils.XRAY_DRIVER_CHANNEL:
# Handles driver death.
@@ -254,16 +254,15 @@ class Monitor(object):
# Call the handler.
message_handler(channel, data)
def update_local_scheduler_map(self):
local_schedulers = self.state.client_table()
self.local_scheduler_id_to_ip_map = {}
for local_scheduler_info in local_schedulers:
client_id = local_scheduler_info.get("DBClientID") or \
local_scheduler_info["ClientID"]
ip_address = (
local_scheduler_info.get("AuxAddress")
or local_scheduler_info["NodeManagerAddress"]).split(":")[0]
self.local_scheduler_id_to_ip_map[client_id] = ip_address
def update_raylet_map(self):
all_raylet_nodes = self.state.client_table()
self.raylet_id_to_ip_map = {}
for raylet_info in all_raylet_nodes:
client_id = (raylet_info.get("DBClientID")
or raylet_info["ClientID"])
ip_address = (raylet_info.get("AuxAddress")
or raylet_info["NodeManagerAddress"]).split(":")[0]
self.raylet_id_to_ip_map[client_id] = ip_address
def _maybe_flush_gcs(self):
"""Experimental: issue a flush request to the GCS.
@@ -311,9 +310,9 @@ class Monitor(object):
# Handle messages from the subscription channels.
while True:
# Update the mapping from local scheduler client ID to IP address.
# Update the mapping from raylet client ID to IP address.
# This is only used to update the load metrics for the autoscaler.
self.update_local_scheduler_map()
self.update_raylet_map()
# Process autoscaling actions
if self.autoscaler: