Better message for connection to the head node when it's listening on localhost. (#24945)

For mac and windows, we default to start the head node with 127.0.0.1 to avoid security pop-ups and assume people won't use cluster mode a lot. However, when people do want to create a mac/windows cluster, our connection message is confusing since we cannot connect to the head node that's listening on 127.0.0.1. This PR tells people what to do in this case (e.g. use node-ip-address).
This commit is contained in:
Jiajun Yao 2022-05-19 09:46:34 -07:00 committed by GitHub
parent 3815e52a61
commit c3045e5295
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 1 deletions

View file

@ -770,6 +770,17 @@ def start(
cf.bold(" ray start --address='{}'"),
bootstrap_addresses,
)
if bootstrap_addresses.startswith("127.0.0.1:"):
cli_logger.print(
"This Ray runtime only accepts connections from local host."
)
cli_logger.print(
"To accept connections from remote hosts, "
"specify a public ip when starting"
)
cli_logger.print(
"the head node: ray start --head --node-ip-address=<public-ip>."
)
cli_logger.newline()
cli_logger.print("Alternatively, use the following Python code:")
with cli_logger.indented():

View file

@ -262,7 +262,10 @@ def test_ray_start(configure_lang, monkeypatch, tmp_path):
_die_on_error(runner.invoke(scripts.stop))
_check_output_via_pattern("test_ray_start.txt", result)
if ray.util.get_node_ip_address() == "127.0.0.1":
_check_output_via_pattern("test_ray_start_localhost.txt", result)
else:
_check_output_via_pattern("test_ray_start.txt", result)
def _ray_start_hook(ray_params, head):

View file

@ -0,0 +1,29 @@
Usage stats collection is enabled by default without user confirmation because this stdin is detected to be non-interactively\..+
Local node IP: .+
--------------------
Ray runtime started.
--------------------
Next steps
To connect to this Ray runtime from another node, run
ray start --address='.+'
This Ray runtime only accepts connections from local host.
To accept connections from remote hosts, specify a public ip when starting
the head node: ray start --head --node-ip-address=<public-ip>.
Alternatively, use the following Python code:
import ray
ray\.init\(address='auto'\)
To connect to this Ray runtime from outside of the cluster, for example to
connect to a remote cluster from your laptop directly, use the following
Python code:
import ray
ray\.init\(address='ray://.*'\)
If connection fails, check your firewall settings and network configuration.
To terminate the Ray runtime, run
ray stop