[autoscaler] Add hard kill and monitor commands (#5082)

* Add hard kill and monitor commands

* better_commands

* Update python/ray/scripts/scripts.py

Co-Authored-By: Kristian Hartikainen <kristian.hartikainen@gmail.com>
This commit is contained in:
Richard Liaw
2019-07-06 21:52:55 -07:00
committed by Eric Liang
parent 445bcb29b0
commit 1798d4f077
2 changed files with 51 additions and 17 deletions
+29 -4
View File
@@ -12,8 +12,8 @@ import sys
import ray.services as services
from ray.autoscaler.commands import (
attach_cluster, exec_cluster, create_or_update_cluster, rsync,
teardown_cluster, get_head_node_ip, kill_node, get_worker_node_ips)
attach_cluster, exec_cluster, create_or_update_cluster, monitor_cluster,
rsync, teardown_cluster, get_head_node_ip, kill_node, get_worker_node_ips)
import ray.ray_constants as ray_constants
import ray.utils
@@ -494,16 +494,41 @@ def teardown(cluster_config_file, yes, workers_only, cluster_name):
is_flag=True,
default=False,
help="Don't ask for confirmation.")
@click.option(
"--hard",
is_flag=True,
default=False,
help="Terminates the node via node provider (defaults to a 'soft kill'"
" which terminates Ray but does not actually delete the instances).")
@click.option(
"--cluster-name",
"-n",
required=False,
type=str,
help="Override the configured cluster name.")
def kill_random_node(cluster_config_file, yes, cluster_name):
def kill_random_node(cluster_config_file, yes, hard, cluster_name):
"""Kills a random Ray node. For testing purposes only."""
click.echo("Killed node with IP " +
kill_node(cluster_config_file, yes, cluster_name))
kill_node(cluster_config_file, yes, hard, cluster_name))
@cli.command()
@click.argument("cluster_config_file", required=True, type=str)
@click.option(
"--lines",
required=False,
default=100,
type=int,
help="Number of lines to tail.")
@click.option(
"--cluster-name",
"-n",
required=False,
type=str,
help="Override the configured cluster name.")
def monitor(cluster_config_file, lines, cluster_name):
"""Runs `tail -n [lines] -f /tmp/ray/session_*/logs/monitor*` on head."""
monitor_cluster(cluster_config_file, lines, cluster_name)
@cli.command()