Do not give an error if both RAY_ADDRESS and address is specified on initialization (#13305)

* Finalize handling of RAY_ADDRESS

* lint
This commit is contained in:
Philipp Moritz
2021-01-08 18:31:32 -08:00
committed by GitHub
parent eb6f403b97
commit c5ae30d1d4
+4 -9
View File
@@ -523,7 +523,7 @@ def init(
You can also define an environment variable called `RAY_ADDRESS` in
the same format as the `address` parameter to connect to an existing
cluster with ray.init().
cluster with ray.init() or ray.init(address="auto").
Args:
address (str): The address of the Ray cluster to connect to. If
@@ -532,7 +532,9 @@ def init(
It will also kill these processes when Python exits. If the driver
is running on a node in a Ray cluster, using `auto` as the value
tells the driver to detect the the cluster, removing the need to
specify a specific node address.
specify a specific node address. If the environment variable
`RAY_ADDRESS` is defined and the address is None or "auto", Ray
will set `address` to `RAY_ADDRESS`.
num_cpus (int): Number of CPUs the user wishes to assign to each
raylet. By default, this is set based on virtual cores.
num_gpus (int): Number of GPUs the user wishes to assign to each
@@ -634,13 +636,6 @@ def init(
if "RAY_ADDRESS" in os.environ:
if address is None or address == "auto":
address = os.environ["RAY_ADDRESS"]
else:
raise RuntimeError(
"Cannot use both the RAY_ADDRESS environment variable and "
"the address argument of ray.init simultaneously. If you "
"use RAY_ADDRESS to connect to a specific Ray cluster, "
"please call ray.init() or ray.init(address=\"auto\") on the "
"driver.")
# Convert hostnames to numerical IP address.
if _node_ip_address is not None: