Skip to content

Commit

Permalink
Tweak/exec attach info (ray-project#3447)
Browse files Browse the repository at this point in the history
* Add custom cluster name to exec info

* Update submit info to match exec info
  • Loading branch information
hartikainen authored and ericl committed Dec 4, 2018
1 parent d820597 commit be6567e
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions python/ray/scripts/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,21 @@ def submit(cluster_config_file, screen, tmux, stop, start, cluster_name,
cmd = " ".join(["python", target] + list(script_args))
exec_cluster(cluster_config_file, cmd, screen, tmux, stop, False,
cluster_name, port_forward)
if tmux:
logger.info("Use `ray attach {} --tmux` "
"to check on command status.".format(cluster_config_file))

if tmux or screen:
attach_command_parts = ["ray attach", cluster_config_file]
if cluster_name is not None:
attach_command_parts.append(
"--cluster-name={}".format(cluster_name))
if tmux:
attach_command_parts.append("--tmux")
elif screen:
attach_command_parts.append("--screen")

attach_command = " ".join(attach_command_parts)
attach_info = "Use `{}` to check on command status.".format(
attach_command)
logger.info(attach_info)


@cli.command()
Expand Down Expand Up @@ -627,11 +639,24 @@ def submit(cluster_config_file, screen, tmux, stop, start, cluster_name,
def exec_cmd(cluster_config_file, cmd, screen, tmux, 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))

if tmux or screen:
attach_command_parts = ["ray attach", cluster_config_file]
if cluster_name is not None:
attach_command_parts.append(
"--cluster-name={}".format(cluster_name))
if tmux:
attach_command_parts.append("--tmux")
elif screen:
attach_command_parts.append("--screen")

attach_command = " ".join(attach_command_parts)
attach_info = "Use `{}` to check on command status.".format(
attach_command)
logger.info(attach_info)


@cli.command()
Expand Down

0 comments on commit be6567e

Please sign in to comment.