ray/dashboard/modules/job/tests
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
..
backwards_compatibility_scripts [Jobs] Reenable test_backwards_compatibility using Ray 1.12 (#24124) 2022-04-26 13:53:51 -05:00
subprocess_driver_scripts [api] Annotate as public / move ray-core APIs to _private and add enforcement rule (#25695) 2022-06-21 15:13:29 -07:00
pip_install_test-0.5-py3-none-any.whl [runtime env] Support .whl files in py_modules (#22368) 2022-03-16 16:37:10 -05:00
test_backwards_compatibility.py [Jobs] Reenable test_backwards_compatibility using Ray 1.12 (#24124) 2022-04-26 13:53:51 -05:00
test_cli.py [job submission] Fix address defaulting behavior (#24970) 2022-05-20 14:10:36 -05:00
test_cli_integration.py [minor] Add a job submission hook by env var (#25343) 2022-06-01 11:15:43 -07:00
test_common.py [runtime env] Support .whl files in py_modules (#22368) 2022-03-16 16:37:10 -05:00
test_http_job_server.py Revert "Revert "[Dashboard][Serve] Move Serve related endpoints to dashboard agent"" (#26336) 2022-07-06 19:37:30 -07:00
test_job_manager.py [core] ray.init defaults to an existing Ray instance if there is one (#26678) 2022-07-23 11:27:22 -07:00
test_sdk.py [runtime_env] Add temporary URI reference to prevent URI deletion before job starts (#24719) 2022-05-23 10:25:04 -05:00
test_utils.py [CI] Format Python code with Black (#21975) 2022-01-29 18:41:57 -08:00