mirror of
https://github.com/wassname/ray.git
synced 2026-07-09 19:08:40 +08:00
[autoscaler] Speedups (#3720)
- NodeUpdater gets its' IP in parallel now (no longer in __init__) - We use persistent connections in SSH (temp folder created only for ray; ControlMaster) - hash_runtime_conf was performing a pointless hexlify step, wasting time on large files - We use NodeUpdaterThreads and share the NodeProvider; NodeUpdaterProcess is removed - AWSNodeProvider caches nodes more aggressively - NodeProvider now has a shim batch terminate_nodes() call; AWSNodeProvider parallelises it; the autoscaler uses it - AWSNodeProvider batches EC2 update_tags calls - Logging changes throughout to provide standardised timing information for profiling - Pulled out a few unnecessary is_running calls (NodeUpdater will loop waiting for SSH anyway) ## Related issue number Issue #3599
This commit is contained in:
committed by
Richard Liaw
parent
ff3c6af1d6
commit
315edab085
+19
-12
@@ -20,7 +20,6 @@ from ray.services import get_ip_address, get_port
|
||||
from ray.utils import (binary_to_hex, binary_to_object_id, hex_to_binary,
|
||||
setup_logger)
|
||||
|
||||
# Set up logging.
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -69,8 +68,10 @@ class Monitor(object):
|
||||
# that redis server.
|
||||
addr_port = self.redis.lrange("RedisShards", 0, -1)
|
||||
if len(addr_port) > 1:
|
||||
logger.warning("TODO: if launching > 1 redis shard, flushing "
|
||||
"needs to touch shards in parallel.")
|
||||
logger.warning(
|
||||
"Monitor: "
|
||||
"TODO: if launching > 1 redis shard, flushing needs to "
|
||||
"touch shards in parallel.")
|
||||
self.issue_gcs_flushes = False
|
||||
else:
|
||||
addr_port = addr_port[0].split(b":")
|
||||
@@ -82,6 +83,7 @@ class Monitor(object):
|
||||
self.redis_shard.execute_command("HEAD.FLUSH 0")
|
||||
except redis.exceptions.ResponseError as e:
|
||||
logger.info(
|
||||
"Monitor: "
|
||||
"Turning off flushing due to exception: {}".format(
|
||||
str(e)))
|
||||
self.issue_gcs_flushes = False
|
||||
@@ -128,8 +130,9 @@ class Monitor(object):
|
||||
self.load_metrics.update(ip, static_resources,
|
||||
dynamic_resources)
|
||||
else:
|
||||
print("Warning: could not find ip for client {} in {}.".format(
|
||||
client_id, self.local_scheduler_id_to_ip_map))
|
||||
logger.warning(
|
||||
"Monitor: "
|
||||
"could not find ip for client {}".format(client_id))
|
||||
|
||||
def _xray_clean_up_entries_for_driver(self, driver_id):
|
||||
"""Remove this driver's object/task entries from redis.
|
||||
@@ -185,11 +188,14 @@ class Monitor(object):
|
||||
continue
|
||||
redis = self.state.redis_clients[shard_index]
|
||||
num_deleted = redis.delete(*keys)
|
||||
logger.info("Removed {} dead redis entries of the driver from"
|
||||
" redis shard {}.".format(num_deleted, shard_index))
|
||||
logger.info("Monitor: "
|
||||
"Removed {} dead redis entries of the "
|
||||
"driver from redis shard {}.".format(
|
||||
num_deleted, shard_index))
|
||||
if num_deleted != len(keys):
|
||||
logger.warning("Failed to remove {} relevant redis entries"
|
||||
" from redis shard {}.".format(
|
||||
logger.warning("Monitor: "
|
||||
"Failed to remove {} relevant redis "
|
||||
"entries from redis shard {}.".format(
|
||||
len(keys) - num_deleted, shard_index))
|
||||
|
||||
def xray_driver_removed_handler(self, unused_channel, data):
|
||||
@@ -205,8 +211,9 @@ class Monitor(object):
|
||||
message = ray.gcs_utils.DriverTableData.GetRootAsDriverTableData(
|
||||
driver_data, 0)
|
||||
driver_id = message.DriverId()
|
||||
logger.info("XRay Driver {} has been removed.".format(
|
||||
binary_to_hex(driver_id)))
|
||||
logger.info("Monitor: "
|
||||
"XRay Driver {} has been removed.".format(
|
||||
binary_to_hex(driver_id)))
|
||||
self._xray_clean_up_entries_for_driver(driver_id)
|
||||
|
||||
def process_messages(self, max_messages=10000):
|
||||
@@ -281,7 +288,7 @@ class Monitor(object):
|
||||
max_entries_to_flush = self.gcs_flush_policy.num_entries_to_flush()
|
||||
num_flushed = self.redis_shard.execute_command(
|
||||
"HEAD.FLUSH {}".format(max_entries_to_flush))
|
||||
logger.info("num_flushed {}".format(num_flushed))
|
||||
logger.info("Monitor: num_flushed {}".format(num_flushed))
|
||||
|
||||
# This flushes event log and log files.
|
||||
ray.experimental.flush_redis_unsafe(self.redis)
|
||||
|
||||
Reference in New Issue
Block a user