mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 17:02:43 +08:00
This reverts commit 4044af8520.
This commit is contained in:
committed by
Eric Liang
parent
b924299833
commit
f24d96ec4f
@@ -430,6 +430,7 @@ 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",
|
||||
|
||||
@@ -605,9 +605,6 @@ class Node(object):
|
||||
# The dashboard is Python3.x only.
|
||||
if PY3 and self._ray_params.include_webui:
|
||||
self.start_dashboard()
|
||||
else:
|
||||
logger.info(
|
||||
"To enable the Ray Web UI, run `pip install ray[dashboard]`.")
|
||||
|
||||
def start_ray_processes(self):
|
||||
"""Start all of the processes on the node."""
|
||||
|
||||
@@ -58,8 +58,8 @@ class RayParams(object):
|
||||
include_webui: Boolean flag indicating whether to start the web
|
||||
UI, which displays the status of the Ray cluster.
|
||||
webui_host: 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
|
||||
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.
|
||||
logging_level: Logging level, default will be logging.INFO.
|
||||
logging_format: Logging format, default contains a timestamp,
|
||||
@@ -108,7 +108,7 @@ class RayParams(object):
|
||||
worker_path=None,
|
||||
huge_pages=False,
|
||||
include_webui=None,
|
||||
webui_host="localhost",
|
||||
webui_host="127.0.0.1",
|
||||
logging_level=logging.INFO,
|
||||
logging_format=ray_constants.LOGGER_FORMAT,
|
||||
plasma_store_socket_name=None,
|
||||
|
||||
@@ -165,10 +165,11 @@ def cli(logging_level, logging_format):
|
||||
@click.option(
|
||||
"--webui-host",
|
||||
required=False,
|
||||
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.")
|
||||
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.")
|
||||
@click.option(
|
||||
"--block",
|
||||
is_flag=True,
|
||||
|
||||
+16
-6
@@ -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
|
||||
@@ -1036,11 +1036,21 @@ def start_dashboard(host,
|
||||
ray_constants.PROCESS_TYPE_DASHBOARD,
|
||||
stdout_file=stdout_file,
|
||||
stderr_file=stderr_file)
|
||||
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))
|
||||
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")
|
||||
return dashboard_url, process_info
|
||||
|
||||
|
||||
|
||||
@@ -2963,11 +2963,7 @@ def test_global_state_api(shutdown_only):
|
||||
with pytest.raises(Exception, match=error_message):
|
||||
ray.jobs()
|
||||
|
||||
ray.init(
|
||||
num_cpus=5,
|
||||
num_gpus=3,
|
||||
resources={"CustomResource": 1},
|
||||
include_webui=False)
|
||||
ray.init(num_cpus=5, num_gpus=3, resources={"CustomResource": 1})
|
||||
|
||||
assert ray.cluster_resources()["CPU"] == 5
|
||||
assert ray.cluster_resources()["GPU"] == 3
|
||||
@@ -3052,7 +3048,6 @@ def test_global_state_api(shutdown_only):
|
||||
assert object_table[result_id] == object_table_entry
|
||||
|
||||
job_table = ray.jobs()
|
||||
print(job_table)
|
||||
|
||||
assert len(job_table) == 1
|
||||
assert job_table[0]["JobID"] == job_id.hex()
|
||||
@@ -3170,7 +3165,7 @@ def test_workers(shutdown_only):
|
||||
|
||||
def test_specific_job_id():
|
||||
dummy_driver_id = ray.JobID.from_int(1)
|
||||
ray.init(num_cpus=1, job_id=dummy_driver_id, include_webui=False)
|
||||
ray.init(num_cpus=1, job_id=dummy_driver_id)
|
||||
|
||||
# in driver
|
||||
assert dummy_driver_id == ray._get_runtime_context().current_driver_id
|
||||
|
||||
@@ -42,7 +42,7 @@ def test_worker_stats(ray_start_regular):
|
||||
|
||||
# Check that the rest of the processes are workers, 1 for each CPU.
|
||||
print(reply)
|
||||
assert len(reply.workers_stats) >= num_cpus + 1
|
||||
assert len(reply.workers_stats) == num_cpus + 1
|
||||
views = [view.view_name for view in reply.view_data]
|
||||
assert "redis_latency" in views
|
||||
assert "local_available_resource" in views
|
||||
@@ -53,7 +53,5 @@ def test_worker_stats(ray_start_regular):
|
||||
if p.info["pid"] in pids
|
||||
]
|
||||
for process in processes:
|
||||
# TODO(ekl): what is with travis/mi when running in Travis?
|
||||
assert ("python" in process or "ray" in process
|
||||
or "travis/mi" in process)
|
||||
assert "python" in process or "ray" in process
|
||||
break
|
||||
|
||||
@@ -19,13 +19,12 @@ def test_get_webui(shutdown_only):
|
||||
webui_url = addresses["webui_url"]
|
||||
assert ray.get_webui_url() == webui_url
|
||||
|
||||
assert re.match(r"^(localhost|\d+\.\d+\.\d+\.\d+):8080$", webui_url)
|
||||
assert re.match(r"^http://\d+\.\d+\.\d+\.\d+:8080$", webui_url)
|
||||
|
||||
start_time = time.time()
|
||||
while True:
|
||||
try:
|
||||
node_info = requests.get("http://" + webui_url +
|
||||
"/api/node_info").json()
|
||||
node_info = requests.get(webui_url + "/api/node_info").json()
|
||||
break
|
||||
except requests.exceptions.ConnectionError:
|
||||
if time.time() > start_time + 30:
|
||||
|
||||
@@ -66,11 +66,6 @@ ERROR_KEY_PREFIX = b"Error:"
|
||||
# entry/init points.
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
import aiohttp
|
||||
except ImportError:
|
||||
aiohttp = None
|
||||
|
||||
try:
|
||||
import setproctitle
|
||||
except ImportError:
|
||||
@@ -546,8 +541,8 @@ def init(address=None,
|
||||
redis_password=None,
|
||||
plasma_directory=None,
|
||||
huge_pages=False,
|
||||
include_webui=aiohttp is not None,
|
||||
webui_host="localhost",
|
||||
include_webui=False,
|
||||
webui_host="127.0.0.1",
|
||||
job_id=None,
|
||||
configure_logging=True,
|
||||
logging_level=logging.INFO,
|
||||
@@ -628,8 +623,8 @@ def init(address=None,
|
||||
include_webui: Boolean flag indicating whether to start the web
|
||||
UI, which displays the status of the Ray cluster.
|
||||
webui_host: 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
|
||||
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.
|
||||
job_id: The ID of this job.
|
||||
configure_logging: True if allow the logging cofiguration here.
|
||||
|
||||
Reference in New Issue
Block a user