From 625b66bde7b342e9897ff4c5e28263c637c3b2fc Mon Sep 17 00:00:00 2001 From: Richard Liaw Date: Sat, 27 Jun 2020 12:56:56 -0700 Subject: [PATCH] [docs] Show commands on documentation (#9165) --- doc/source/package-ref.rst | 10 +++++----- python/ray/scripts/scripts.py | 28 +++++++++++++++------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/doc/source/package-ref.rst b/doc/source/package-ref.rst index b06548541..35e2bc6fb 100644 --- a/doc/source/package-ref.rst +++ b/doc/source/package-ref.rst @@ -71,19 +71,19 @@ The Ray Command Line API .. _ray-up-doc: -.. click:: ray.scripts.scripts:create_or_update +.. click:: ray.scripts.scripts:up :prog: ray up :show-nested: .. _ray-down-doc: -.. click:: ray.scripts.scripts:teardown +.. click:: ray.scripts.scripts:down :prog: ray down :show-nested: .. _ray-exec-doc: -.. click:: ray.scripts.scripts:exec_cmd +.. click:: ray.scripts.scripts:exec :prog: ray exec :show-nested: @@ -113,8 +113,8 @@ The Ray Command Line API .. _ray-stat-doc: -.. click:: ray.scripts.scripts:stat - :prog: ray stat +.. click:: ray.scripts.scripts:statistics + :prog: ray statistics :show-nested: .. _ray-memory-doc: diff --git a/python/ray/scripts/scripts.py b/python/ray/scripts/scripts.py index 276396de9..2598412bd 100644 --- a/python/ray/scripts/scripts.py +++ b/python/ray/scripts/scripts.py @@ -621,7 +621,7 @@ def stop(force, verbose): logger.error("Error: %s", ex) -@cli.command(hidden=True) +@cli.command() @click.argument("cluster_config_file", required=True, type=str) @click.option( "--no-restart", @@ -657,8 +657,8 @@ def stop(force, verbose): is_flag=True, default=False, help="Don't ask for confirmation.") -def create_or_update(cluster_config_file, min_workers, max_workers, no_restart, - restart_only, yes, cluster_name): +def up(cluster_config_file, min_workers, max_workers, no_restart, restart_only, + yes, cluster_name): """Create or update a Ray cluster.""" if restart_only or no_restart: assert restart_only != no_restart, "Cannot set both 'restart_only' " \ @@ -677,7 +677,7 @@ def create_or_update(cluster_config_file, min_workers, max_workers, no_restart, no_restart, restart_only, yes, cluster_name) -@cli.command(hidden=True) +@cli.command() @click.argument("cluster_config_file", required=True, type=str) @click.option( "--workers-only", @@ -701,8 +701,8 @@ def create_or_update(cluster_config_file, min_workers, max_workers, no_restart, required=False, type=str, help="Override the configured cluster name.") -def teardown(cluster_config_file, yes, workers_only, cluster_name, - keep_min_workers): +def down(cluster_config_file, yes, workers_only, cluster_name, + keep_min_workers): """Tear down a Ray cluster.""" teardown_cluster(cluster_config_file, yes, workers_only, cluster_name, keep_min_workers) @@ -915,7 +915,7 @@ def submit(cluster_config_file, screen, tmux, stop, start, cluster_name, port_forward=port_forward) -@cli.command(hidden=True) +@cli.command() @click.argument("cluster_config_file", required=True, type=str) @click.argument("cmd", required=True, type=str) @click.option( @@ -955,8 +955,8 @@ def submit(cluster_config_file, screen, tmux, stop, start, cluster_name, multiple=True, type=int, help="Port to forward. Use this multiple times to forward multiple ports.") -def exec_cmd(cluster_config_file, cmd, run_env, screen, tmux, stop, start, - cluster_name, port_forward): +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, @@ -1131,14 +1131,16 @@ def add_command_alias(command, name, hidden): cli.add_command(dashboard) cli.add_command(start) cli.add_command(stop) -add_command_alias(create_or_update, name="up", hidden=False) +cli.add_command(up) +add_command_alias(up, name="create_or_update", hidden=True) cli.add_command(attach) -add_command_alias(exec_cmd, name="exec", hidden=False) +cli.add_command(exec) +add_command_alias(exec, name="exec_cmd", hidden=True) add_command_alias(rsync_down, name="rsync_down", hidden=True) add_command_alias(rsync_up, name="rsync_up", hidden=True) cli.add_command(submit) -cli.add_command(teardown) -add_command_alias(teardown, name="down", hidden=False) +cli.add_command(down) +add_command_alias(down, name="teardown", hidden=True) cli.add_command(kill_random_node) add_command_alias(get_head_ip, name="get_head_ip", hidden=True) cli.add_command(get_worker_ips)