From ed8a4dc3fd5de7574a18cfea7c4ad6fc3b4c62e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Movchan Date: Thu, 21 Nov 2024 16:10:09 +0000 Subject: [PATCH 1/3] Add options for Ray dashboard address and port in CLI --- aana/cli.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/aana/cli.py b/aana/cli.py index 829dbe63..6a861a6e 100644 --- a/aana/cli.py +++ b/aana/cli.py @@ -50,6 +50,22 @@ def load_app(app_path: str): type=str, help="Address of the Ray cluster (default: auto)", ) +@click.option( + "--ray-dashboard-address", + default="127.0.0.1", + type=str, + help=( + "The host to bind the dashboard server to. Can either be " + "localhost (127.0.0.1) or 0.0.0.0 (available from all interfaces). " + "By default, this is set to localhost to prevent access from external machines." + ), +) +@click.option( + "--ray-dashboard-port", + default=8265, + type=int, + help="The port to bind the dashboard server to (default: 8265)", +) @click.option( "--skip-migrations", is_flag=True, @@ -61,6 +77,8 @@ def deploy( port: int, hide_logs: bool, ray_address: str, + ray_dashboard_address: str, + ray_dashboard_port: int, skip_migrations: bool, ): """Deploy the application. @@ -71,7 +89,14 @@ def deploy( if not skip_migrations: aana_app.migrate() show_logs = not hide_logs - aana_app.connect(port=port, host=host, show_logs=show_logs, address=ray_address) + aana_app.connect( + port=port, + host=host, + show_logs=show_logs, + address=ray_address, + dashboard_address=ray_dashboard_address, + dashboard_port=ray_dashboard_port, + ) with contextlib.suppress( DeploymentException ): # we have a nice error message for this From ed16a5df99ef77b592dabcac834d1af25ea63838 Mon Sep 17 00:00:00 2001 From: Aleksandr Movchan Date: Thu, 21 Nov 2024 16:19:30 +0000 Subject: [PATCH 2/3] Rename Ray dashboard address option to host in CLI --- aana/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aana/cli.py b/aana/cli.py index 6a861a6e..706ce5e3 100644 --- a/aana/cli.py +++ b/aana/cli.py @@ -51,7 +51,7 @@ def load_app(app_path: str): help="Address of the Ray cluster (default: auto)", ) @click.option( - "--ray-dashboard-address", + "--ray-dashboard-host", default="127.0.0.1", type=str, help=( @@ -77,7 +77,7 @@ def deploy( port: int, hide_logs: bool, ray_address: str, - ray_dashboard_address: str, + ray_dashboard_host: str, ray_dashboard_port: int, skip_migrations: bool, ): @@ -94,7 +94,7 @@ def deploy( host=host, show_logs=show_logs, address=ray_address, - dashboard_address=ray_dashboard_address, + dashboard_host=ray_dashboard_host, dashboard_port=ray_dashboard_port, ) with contextlib.suppress( From 04730531cb9e6e662d0ee81b91192c55fe86948e Mon Sep 17 00:00:00 2001 From: Aleksandr Movchan Date: Fri, 22 Nov 2024 09:19:14 +0000 Subject: [PATCH 3/3] Move dashboard parameters to initial Ray startup command. --- aana/sdk.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aana/sdk.py b/aana/sdk.py index 9977c1e7..fe717f55 100644 --- a/aana/sdk.py +++ b/aana/sdk.py @@ -106,9 +106,6 @@ def connect( address=address, ignore_reinit_error=True, log_to_driver=show_logs, - include_dashboard=True, - dashboard_host=dashboard_host, - dashboard_port=dashboard_port, ) except ConnectionError: # If connection fails, start a new Ray cluster and serve instance @@ -117,6 +114,9 @@ def connect( log_to_driver=show_logs, num_cpus=num_cpus, num_gpus=num_gpus, + include_dashboard=True, + dashboard_host=dashboard_host, + dashboard_port=dashboard_port, ) serve_status = serve.status()