ray/doc/source/ray-core
Stephanie Wang 55a0f7bb2d
[core] ray.init defaults to an existing Ray instance if there is one (#26678)
ray.init() will currently start a new Ray instance even if one is already existing, which is very confusing if you are a new user trying to go from local development to a cluster. This PR changes it so that, when no address is specified, we first try to find an existing Ray cluster that was created through `ray start`. If none is found, we will start a new one.

This makes two changes to the ray.init() resolution order:
1. When `ray start` is called, the started cluster address was already written to a file called `/tmp/ray/ray_current_cluster`. For ray.init() and ray.init(address="auto"), we will first check this local file for an existing cluster address. The file is deleted on `ray stop`. If the file is empty, autodetect any running cluster (legacy behavior) if address="auto", or we will start a new local Ray instance if address=None.
2. When ray.init(address="local") is called, we will create a new local Ray instance, even if one is already existing. This behavior seems to be necessary mainly for `ray.client` use cases.

This also surfaces the logs about which Ray instance we are connecting to. Previously these were hidden because we didn't set up the log until after connecting to Ray. So now Ray will log one of the following messages during ray.init:
```
(Connecting to existing Ray cluster at address: <IP>...)
...connection...
(Started a local Ray cluster.| Connected to Ray Cluster.)( View the dashboard at <URL>)
```

Note that this changes the dashboard URL to be printed with `ray.init()` instead of when the dashboard is first started.

Co-authored-by: Eric Liang <ekhliang@gmail.com>
2022-07-23 11:27:22 -07:00
..
_examples/datasets_train [air] Allow users to use instances of ScalingConfig (#25712) 2022-07-18 15:46:58 -07:00
actors Add doc for custom lifetime of java actor (#26706) 2022-07-20 22:19:44 +08:00
doc_code [core/docs]Add a new section under Ray Core called Ray Gotchas (#26624) 2022-07-16 16:53:01 -07:00
examples add missing brackets (#25992) 2022-06-22 15:30:55 -05:00
images [docs] Add an example for simple highly parallelizable tasks. (#24885) 2022-06-08 18:10:37 -07:00
objects [Core][Doc] add docs for out of disk prevention. (#26291) 2022-07-06 07:37:54 -07:00
tasks Revert "[Core] Add retry exception allowlist for user-defined filteri… (#26289) 2022-07-05 15:17:36 -07:00
actors.rst [Doc] Fix actor example (#26381) 2022-07-07 21:19:51 -07:00
advanced.rst [Core][Doc] remove cython section from advanced doc. #26062 2022-06-24 10:39:45 -07:00
configure.rst [script] expose options of xxx_port in 'ray start' command (#24919) 2022-05-23 17:18:09 +08:00
cross-language.rst [Java][API CHANGE] Move exception to api module. (#24540) 2022-05-19 10:18:20 +08:00
gotchas.rst [core/docs]Add a new section under Ray Core called Ray Gotchas (#26624) 2022-07-16 16:53:01 -07:00
handling-dependencies.rst [runtime_env] [doc] Remove outdated info about "isolated" environment (#26314) 2022-07-08 14:15:12 -05:00
key-concepts.rst [docs] Core docs refactor (#23216) 2022-03-17 11:26:17 -07:00
more-topics.rst [core/docs]Add a new section under Ray Core called Ray Gotchas (#26624) 2022-07-16 16:53:01 -07:00
namespaces.rst [Core][C++ worker] Add GetNamespace api (#26509) 2022-07-20 11:17:14 +08:00
objects.rst [Core] Make "GetTimeoutError" a subclass of "TimeoutError" (#26771) 2022-07-20 14:37:39 -05:00
package-ref.rst [Placement group] Update the old placement group API usage to the new scheduling_strategy based API (#24544) 2022-05-18 09:41:51 -07:00
placement-group.rst [Placement group] Update the old placement group API usage to the new scheduling_strategy based API (#24544) 2022-05-18 09:41:51 -07:00
ray-dag.rst [Ray DAG] Move dag project folder out of experimental (#25532) 2022-06-16 19:15:39 -07:00
ray-dashboard.rst Fix broken links in documentation and put linkcheck linter in place on CI (#23340) 2022-03-18 21:02:52 -07:00
starting-ray.rst [core] ray.init defaults to an existing Ray instance if there is one (#26678) 2022-07-23 11:27:22 -07:00
tasks.rst Revert "Revert "[core] Support generators for tasks with multiple return values (#25247)" (#25380)" (#25383) 2022-06-02 10:50:11 -07:00
tips-for-first-time.rst [docs] Core docs refactor (#23216) 2022-03-17 11:26:17 -07:00
troubleshooting.rst Fix broken links in documentation and put linkcheck linter in place on CI (#23340) 2022-03-18 21:02:52 -07:00
user-guide.rst [docs] Core docs refactor (#23216) 2022-03-17 11:26:17 -07:00
using-ray-with-jupyter.rst [docs] re/move old core examples (#22802) 2022-03-10 12:17:00 -08:00
walkthrough.rst [core] ray.init defaults to an existing Ray instance if there is one (#26678) 2022-07-23 11:27:22 -07:00