mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 19:49:04 +08:00
[autoscaler] Add tmux support for attach and exec (#2907)
Adds a tmux flag that can be used to support background execution of experiments. Cannot be used together with screen. Seems to be useful feature that has shown up with different users.
This commit is contained in:
@@ -470,14 +470,16 @@ def teardown(cluster_config_file, yes, workers_only, cluster_name):
|
||||
is_flag=True,
|
||||
default=False,
|
||||
help=("Start the cluster if needed."))
|
||||
@click.option(
|
||||
"--tmux", is_flag=True, default=False, help=("Run the command in tmux."))
|
||||
@click.option(
|
||||
"--cluster-name",
|
||||
"-n",
|
||||
required=False,
|
||||
type=str,
|
||||
help=("Override the configured cluster name."))
|
||||
def attach(cluster_config_file, start, cluster_name):
|
||||
attach_cluster(cluster_config_file, start, cluster_name)
|
||||
def attach(cluster_config_file, start, tmux, cluster_name):
|
||||
attach_cluster(cluster_config_file, start, tmux, cluster_name)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@@ -526,6 +528,8 @@ def rsync_up(cluster_config_file, source, target, cluster_name):
|
||||
is_flag=True,
|
||||
default=False,
|
||||
help=("Run the command in a screen."))
|
||||
@click.option(
|
||||
"--tmux", is_flag=True, default=False, help=("Run the command in tmux."))
|
||||
@click.option(
|
||||
"--cluster-name",
|
||||
"-n",
|
||||
@@ -534,10 +538,14 @@ def rsync_up(cluster_config_file, source, target, cluster_name):
|
||||
help=("Override the configured cluster name."))
|
||||
@click.option(
|
||||
"--port-forward", required=False, type=int, help=("Port to forward."))
|
||||
def exec_cmd(cluster_config_file, cmd, screen, stop, start, cluster_name,
|
||||
def exec_cmd(cluster_config_file, cmd, screen, tmux, stop, start, cluster_name,
|
||||
port_forward):
|
||||
exec_cluster(cluster_config_file, cmd, screen, stop, start, cluster_name,
|
||||
port_forward)
|
||||
assert not (screen and tmux), "Can specify only one of `screen` or `tmux`."
|
||||
exec_cluster(cluster_config_file, cmd, screen, tmux, stop, start,
|
||||
cluster_name, port_forward)
|
||||
if tmux:
|
||||
logger.info("Use `ray attach {} --tmux` "
|
||||
"to check on command status.".format(cluster_config_file))
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
||||
Reference in New Issue
Block a user