Add "ray status" debug tool for autoscaler. (#9091)

This commit is contained in:
Eric Liang
2020-06-24 18:22:03 -07:00
committed by GitHub
parent 80bcbe20c7
commit 0ff24ec8dc
8 changed files with 87 additions and 20 deletions
+20 -3
View File
@@ -15,7 +15,8 @@ import psutil
import ray.services as services
from ray.autoscaler.commands import (
attach_cluster, exec_cluster, create_or_update_cluster, monitor_cluster,
rsync, teardown_cluster, get_head_node_ip, kill_node, get_worker_node_ips)
rsync, teardown_cluster, get_head_node_ip, kill_node, get_worker_node_ips,
debug_status)
import ray.ray_constants as ray_constants
import ray.utils
from ray.projects.scripts import project_cli, session_cli
@@ -1055,7 +1056,7 @@ def timeline(address):
required=False,
type=str,
help="Override the address to connect to.")
def stat(address):
def statistics(address):
"""Get the current metrics protobuf from a Ray cluster (developer tool)."""
if not address:
address = services.find_redis_address_or_die()
@@ -1094,6 +1095,21 @@ def memory(address):
print(ray.internal.internal_api.memory_summary())
@cli.command()
@click.option(
"--address",
required=False,
type=str,
help="Override the address to connect to.")
def status(address):
"""Print cluster status, including autoscaling info."""
if not address:
address = services.find_redis_address_or_die()
logger.info("Connecting to Ray instance at {}.".format(address))
ray.init(address=address)
print(debug_status())
@cli.command()
@click.option(
"--address",
@@ -1132,7 +1148,8 @@ add_command_alias(get_head_ip, name="get_head_ip", hidden=True)
cli.add_command(get_worker_ips)
cli.add_command(microbenchmark)
cli.add_command(stack)
cli.add_command(stat)
cli.add_command(statistics)
cli.add_command(status)
cli.add_command(memory)
cli.add_command(globalgc)
cli.add_command(timeline)