[autoscaler] Require keyword arguments (#9256)

This commit is contained in:
Ian Rodney
2020-07-06 22:12:59 -07:00
committed by GitHub
parent 1425cdf834
commit 079c1eaa5c
2 changed files with 48 additions and 13 deletions
+32 -6
View File
@@ -137,8 +137,17 @@ def teardown_cluster(config_file, yes, workers_only, override_cluster_name,
if not workers_only:
try:
exec_cluster(config_file, "ray stop", "auto", False, False, False,
False, override_cluster_name, None, False)
exec_cluster(
config_file,
cmd="ray stop",
run_env="auto",
screen=False,
tmux=False,
stop=False,
start=False,
override_cluster_name=override_cluster_name,
port_forward=None,
with_output=False)
except Exception:
logger.exception("Ignoring error attempting a clean shutdown.")
@@ -230,8 +239,16 @@ def kill_node(config_file, yes, hard, override_cluster_name):
def monitor_cluster(cluster_config_file, num_lines, override_cluster_name):
"""Tails the autoscaler logs of a Ray cluster."""
cmd = "tail -n {} -f /tmp/ray/session_*/logs/monitor*".format(num_lines)
exec_cluster(cluster_config_file, cmd, "auto", False, False, False, False,
override_cluster_name, None)
exec_cluster(
cluster_config_file,
cmd=cmd,
run_env="auto",
screen=False,
tmux=False,
stop=False,
start=False,
override_cluster_name=override_cluster_name,
port_forward=None)
def warn_about_bad_start_command(start_commands):
@@ -418,11 +435,20 @@ def attach_cluster(config_file, start, use_screen, use_tmux,
"--new only makes sense if passing --screen or --tmux")
cmd = "$SHELL"
exec_cluster(config_file, cmd, "auto", False, False, False, start,
override_cluster_name, port_forward)
exec_cluster(
config_file,
cmd=cmd,
run_env="auto",
screen=False,
tmux=False,
stop=False,
start=start,
override_cluster_name=override_cluster_name,
port_forward=port_forward)
def exec_cluster(config_file,
*,
cmd=None,
run_env="auto",
screen=False,
+16 -7
View File
@@ -904,11 +904,11 @@ def submit(cluster_config_file, screen, tmux, stop, start, cluster_name,
cmd = " ".join(command_parts)
exec_cluster(
cluster_config_file,
cmd,
"docker",
screen,
tmux,
stop,
cmd=cmd,
run_env="docker",
screen=screen,
tmux=tmux,
stop=stop,
start=False,
override_cluster_name=cluster_name,
port_forward=port_forward)
@@ -958,8 +958,17 @@ def exec(cluster_config_file, cmd, run_env, screen, tmux, stop, start,
cluster_name, port_forward):
"""Execute a command via SSH on a Ray cluster."""
port_forward = [(port, port) for port in list(port_forward)]
exec_cluster(cluster_config_file, cmd, run_env, screen, tmux, stop, start,
cluster_name, port_forward)
exec_cluster(
cluster_config_file,
cmd=cmd,
run_env=run_env,
screen=screen,
tmux=tmux,
stop=stop,
start=start,
override_cluster_name=cluster_name,
port_forward=port_forward)
@cli.command()