mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
Port webui nits from original pr that enables it (#6628)
* backport changes * Update test_webui.py
This commit is contained in:
parent
3e0f07468f
commit
e2bc489a18
6 changed files with 19 additions and 30 deletions
|
@ -409,7 +409,6 @@ if __name__ == "__main__":
|
|||
"--host",
|
||||
required=True,
|
||||
type=str,
|
||||
choices=["127.0.0.1", "0.0.0.0"],
|
||||
help="The host to use for the HTTP server.")
|
||||
parser.add_argument(
|
||||
"--port",
|
||||
|
|
|
@ -63,8 +63,8 @@ class RayParams(object):
|
|||
None, then the UI will be started if the relevant dependencies are
|
||||
present.
|
||||
webui_host: The host to bind the web UI server to. Can either be
|
||||
127.0.0.1 (localhost) or 0.0.0.0 (available from all interfaces).
|
||||
By default, this is set to 127.0.0.1 to prevent access from
|
||||
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.
|
||||
logging_level: Logging level, default will be logging.INFO.
|
||||
logging_format: Logging format, default contains a timestamp,
|
||||
|
@ -113,7 +113,7 @@ class RayParams(object):
|
|||
worker_path=None,
|
||||
huge_pages=False,
|
||||
include_webui=None,
|
||||
webui_host="127.0.0.1",
|
||||
webui_host="localhost",
|
||||
logging_level=logging.INFO,
|
||||
logging_format=ray_constants.LOGGER_FORMAT,
|
||||
plasma_store_socket_name=None,
|
||||
|
|
|
@ -166,11 +166,10 @@ def cli(logging_level, logging_format):
|
|||
@click.option(
|
||||
"--webui-host",
|
||||
required=False,
|
||||
type=click.Choice(["127.0.0.1", "0.0.0.0"]),
|
||||
default="127.0.0.1",
|
||||
help="The host to bind the web UI server to. Can either be 127.0.0.1 "
|
||||
"(localhost) or 0.0.0.0 (available from all interfaces). By default, this "
|
||||
"is set to 127.0.0.1 to prevent access from external machines.")
|
||||
default="localhost",
|
||||
help="The host to bind the web UI 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(
|
||||
"--block",
|
||||
is_flag=True,
|
||||
|
|
|
@ -12,10 +12,10 @@ import resource
|
|||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
import redis
|
||||
|
||||
import colorama
|
||||
import pyarrow
|
||||
# Ray modules
|
||||
import ray
|
||||
|
@ -1094,21 +1094,11 @@ def start_dashboard(require_webui,
|
|||
stdout_file=stdout_file,
|
||||
stderr_file=stderr_file)
|
||||
|
||||
dashboard_url = "http://{}:{}".format(
|
||||
host if host == "127.0.0.1" else get_node_ip_address(), port)
|
||||
print("\n" + "=" * 70)
|
||||
print("View the dashboard at {}.".format(dashboard_url))
|
||||
if host == "127.0.0.1":
|
||||
note = (
|
||||
"Note: If Ray is running on a remote node, you will need to "
|
||||
"set up an SSH tunnel with local port forwarding in order to "
|
||||
"access the dashboard in your browser, e.g. by running "
|
||||
"'ssh -L {}:{}:{} <username>@<host>'. Alternatively, you can "
|
||||
"set webui_host=\"0.0.0.0\" in the call to ray.init() to "
|
||||
"allow direct access from external machines.")
|
||||
note = note.format(port, host, port)
|
||||
print("\n".join(textwrap.wrap(note, width=70)))
|
||||
print("=" * 70 + "\n")
|
||||
dashboard_url = "{}:{}".format(
|
||||
host if host != "0.0.0.0" else get_node_ip_address(), port)
|
||||
logger.info("View the Ray dashboard at {}{}{}{}{}.".format(
|
||||
colorama.Style.BRIGHT, colorama.Fore.GREEN, dashboard_url,
|
||||
colorama.Fore.RESET, colorama.Style.NORMAL))
|
||||
return dashboard_url, process_info
|
||||
else:
|
||||
return None, None
|
||||
|
|
|
@ -19,12 +19,13 @@ def test_get_webui(shutdown_only):
|
|||
webui_url = addresses["webui_url"]
|
||||
assert ray.get_webui_url() == webui_url
|
||||
|
||||
assert re.match(r"^http://\d+\.\d+\.\d+\.\d+:8265$", webui_url)
|
||||
assert re.match(r"^(localhost|\d+\.\d+\.\d+\.\d+):8265$", webui_url)
|
||||
|
||||
start_time = time.time()
|
||||
while True:
|
||||
try:
|
||||
node_info = requests.get(webui_url + "/api/node_info").json()
|
||||
node_info = requests.get("http://" + webui_url +
|
||||
"/api/node_info").json()
|
||||
break
|
||||
except requests.exceptions.ConnectionError:
|
||||
if time.time() > start_time + 30:
|
||||
|
|
|
@ -548,7 +548,7 @@ def init(address=None,
|
|||
plasma_directory=None,
|
||||
huge_pages=False,
|
||||
include_webui=None,
|
||||
webui_host="127.0.0.1",
|
||||
webui_host="localhost",
|
||||
job_id=None,
|
||||
configure_logging=True,
|
||||
logging_level=logging.INFO,
|
||||
|
@ -631,8 +631,8 @@ def init(address=None,
|
|||
is None, then the UI will be started if the relevant dependencies
|
||||
are present.
|
||||
webui_host: The host to bind the web UI server to. Can either be
|
||||
127.0.0.1 (localhost) or 0.0.0.0 (available from all interfaces).
|
||||
By default, this is set to 127.0.0.1 to prevent access from
|
||||
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.
|
||||
job_id: The ID of this job.
|
||||
configure_logging: True if allow the logging cofiguration here.
|
||||
|
|
Loading…
Add table
Reference in a new issue