Skip to content

Commit

Permalink
Do not give an error if both RAY_ADDRESS and address is specified…
Browse files Browse the repository at this point in the history
… on initialization (ray-project#13305)

* Finalize handling of RAY_ADDRESS

* lint
  • Loading branch information
pcmoritz authored Jan 9, 2021
1 parent eb6f403 commit c5ae30d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c5ae30d

Please sign in to comment.