From 3bbafc710530d8fa0be201706f7b4df8e1941f7d Mon Sep 17 00:00:00 2001 From: Richard Liaw Date: Tue, 14 May 2019 19:52:28 -0700 Subject: [PATCH] [autoscaler] Fix submit (#4782) --- python/ray/scripts/scripts.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/ray/scripts/scripts.py b/python/ray/scripts/scripts.py index 01c8e267b..1951af208 100644 --- a/python/ray/scripts/scripts.py +++ b/python/ray/scripts/scripts.py @@ -555,7 +555,7 @@ def rsync_up(cluster_config_file, source, target, cluster_name): rsync(cluster_config_file, source, target, cluster_name, down=False) -@cli.command() +@cli.command(context_settings={"ignore_unknown_options": True}) @click.argument("cluster_config_file", required=True, type=str) @click.option( "--docker", @@ -588,14 +588,17 @@ def rsync_up(cluster_config_file, source, target, cluster_name): @click.option( "--port-forward", required=False, type=int, help="Port to forward.") @click.argument("script", required=True, type=str) -@click.argument("script_args", required=False, type=str, nargs=-1) +@click.option("--args", required=False, type=str, help="Script args.") def submit(cluster_config_file, docker, screen, tmux, stop, start, - cluster_name, port_forward, script, script_args): + cluster_name, port_forward, script, args): """Uploads and runs a script on the specified cluster. The script is automatically synced to the following location: os.path.join("~", os.path.basename(script)) + + Example: + >>> ray submit [CLUSTER.YAML] experiment.py --args="--smoke-test" """ assert not (screen and tmux), "Can specify only one of `screen` or `tmux`." @@ -606,7 +609,7 @@ def submit(cluster_config_file, docker, screen, tmux, stop, start, target = os.path.join("~", os.path.basename(script)) rsync(cluster_config_file, script, target, cluster_name, down=False) - cmd = " ".join(["python", target] + list(script_args)) + cmd = " ".join(["python", target, args]) exec_cluster(cluster_config_file, cmd, docker, screen, tmux, stop, False, cluster_name, port_forward)