Commit graph

6741 commits

Author SHA1 Message Date
xwjiang2010
5c8361a92e
[air] Update to use more verbose default config for trainers. (#24850)
Internal user feedback showing that more detailed logging is preferred:
https://anyscaleteam.slack.com/archives/C030DEV6QLU/p1652481961472729
2022-05-17 16:21:11 +01:00
shrekris-anyscale
3a2bd16eca
[Serve] Add deployment graph import_path and runtime_env to ServeApplicationSchema (#24814)
A newly planned version of the Serve schema (used in the REST API and CLI) requires the user to pass in their deployment graph's`import_path` and optionally a runtime_env containing that graph. This new schema can then pick up any `init_args` and `init_kwargs` values directly from the graph, instead of requiring them to be serialized and passed explicitly into the REST request.

This change:
* Adds the `import_path` and `runtime_env` fields to the `ServeApplicationSchema`.
* Updates or disables outdated unit tests.

Follow-up changes should:
* Update the status schemas (i.e. `DeploymentStatusSchema` and `ServeApplicationStatusSchema`).
* Remove deployment-level `import_path`s.
* Process the new `import_path` and `runtime_env` fields instead of silently ignoring them.
    * Remove `init_args` and `init_kwargs` from `DeploymentSchema` afterwards.

Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
2022-05-17 09:51:06 -05:00
Clark Zinzow
ea635aecd2
[Datasets] Support tensor columns in to_tf and to_torch. (#24752)
This PR adds support for tensor columns in the to_tf() and to_torch() APIs.

For Torch, this involves an explicit extension array check and (zero-copy) conversion of the tensor column to a NumPy array before converting the column to a Torch tensor.

For TensorFlow, this involves bypassing df.values when converting tensor feature columns to NumPy arrays, instead manually creating a single NumPy array from the column Series.

In both cases, I think that the UX around heterogeneous feature columns and squeezing the column dimension could be improved, but I'm saving that for a future PR.
2022-05-17 01:11:00 -07:00
Clark Zinzow
ef870e936c
[Datasets] Change range_arrow() API to range_table() (#24704)
This PR changes the ray.data.range_arrow() to ray.data.range_table(), making the Arrow representation an implementation detail.
2022-05-17 01:09:45 -07:00
Yi Cheng
379fa634ac
[core][2/2] Worker resubscribe when GCS failed (#24813)
A follow-up PR from this one: https://github.com/ray-project/ray/pull/24628

In the previous PR, it fixed the resubscribing issue for raylet. But there is also core worker which needs to do resubscribing.

There are two ways of doing resubscribe:
1. When the client-side detects any failure, it'll do resubscribing.
2. Server side will ask the client to do resubscribing.

1) is a cleaner and better solution. However, it's a little bit hard due to the following reasons:

- We are using long-polling, so for some extreme cases, we won't be able to detect the failure. For example, the client-side received the message, but before it sends another request, the server-side restarts, and the client will miss the opportunity of detecting the failure. This could happen if we have a standby GCS that starts very fast and somehow the client-side has a lot of traffic and runs very slow.
- The current gRPC framework doesn't give the user a way to handle failure which might need some refactoring on this one.

We can go with this way once we have gRPC streaming.

This PR is implementing 2) which includes three parts:
- raylet: (https://github.com/ray-project/ray/pull/24628)
- core worker: (this pr)
- python

Correctness: whenever when a worker started, it'll register to raylet immediately (sync call) before connecting to GCS. So, we just need to send all restart rpcs to registered workers and it should work because:
- if the worker just started and hasn't registered with the raylet: it's ok, because the worker hasn't connected with GCS yet, so no need to do resubscribing.
- if the worker has registered with the rayelt: it's covered by the code path here.
2022-05-16 23:47:52 -07:00
Antoni Baum
7158aeda33
[Datasets] Add Dataset.split_proportionately and ray.ml.train_test_split (#24476)
Adds a Dataset.split_proportionately method that allows the user to split a dataset using proportions. This is a very common use-case for eg. train-test splitting. The implementation is a thin wrapper over Dataset.split_at_indices.

Additionally, this PR adds a ray.ml.train_test_split function intended to provide a familiar API to ML practitioners.
2022-05-16 20:47:29 -07:00
Qing Wang
40774ac219
Minor changes for Java runtime env. (#24840) 2022-05-17 11:33:59 +08:00
Siyuan (Ryans) Zhuang
2766284b14
[workflow] Update workflow doc and examples (#24804)
* update doc of workflow options

* update examples and make sure they are working
2022-05-16 15:41:14 -07:00
Chen Shen
2e53f48188
[python3.10] build python310 wheels (#24829)
build python3.10 wheels for linux windows and mac.
2022-05-16 12:36:33 -07:00
Edward Oakes
f99aa5cb40
[serve][docs] Unify doc_code directories and add bazel target (#24736)
Split off from https://github.com/ray-project/ray/pull/24693/, unifying the redundant directories we had and making sure all `serve/doc_code` snippets are run in CI.
2022-05-16 09:49:42 -05:00
SangBin Cho
b9c30529d8
[Core/Observability 1/N] Add a "running" state to task status (#24651)
This PR adds 2 more states into TaskStatus

enum TaskStatus {
  // The task is scheduled properly and waiting for execution.
  // It includes time to deliver the task to the remote worker + queueing time
  // from the execution side.
  WAITING_FOR_EXECUTION = 5;
  // The task that is running.
  RUNNING = 6;
}
2022-05-16 05:39:05 -07:00
Yi Cheng
6df45f0978
[core][1/2] Resubscribe when GCS restarts for raylet. (#24628)
## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this solves. -->
This PR fixes the path to resubscribe to GCS when GCS restarts.

When GCS restarts, it'll lose all subscription information since everything is stored in memory. Then in the runtime, we need to tell GCS what's currently being subscribed.

The previous method:
- We'll have a thread in core worker/raylet to check whether the GCS restarted or not.
- If it restarted, we'll send resubscribe request to GCS.

However, this is not working in these cases:
- GCS restarts happen so fast so the checker in raylet/core worker missed them.
- GCS doesn't restart, but just being lag due to network issues then, the resubscribe is not necessary.

Actually, GCS knows when a resubscribe is needed: when it restarts. So the PR here is to send a resubscribe request from GCS -> Raylet and Raylet will do the resubscription.

There are two parts for this to work:

- [x] raylet send resubscription
- [ ] raylet ask core worker to send resubscription
2022-05-15 18:25:58 -07:00
Eric Liang
3f5d870541
[minor] Use np.searchsorted to speed up random access dataset (#24825) 2022-05-15 18:10:17 -07:00
Eric Liang
9381dd174e
[docs] Fix broken code example in docstring for DataParallelTrainer args 2022-05-14 20:48:45 -07:00
Yi Cheng
684e395c5d
Revert "Revert "[core] Move reconnection to RPC layer for GCS client."" (#24764)
* Revert "Revert "[core] Move reconnection to RPC layer for GCS client. (#24330)" (#24762)"

This reverts commit 30f370bf1f.
2022-05-14 20:35:40 -07:00
Clark Zinzow
8e8deaeafd
[Datasets] Add example protocol for reading canned in-package example data. (#24800)
Providing easy-access datasets is table stakes for a good Getting Started UX, but even with good in-package data, it can be difficult to make these paths accessible to the user. This PR adds an "example://" protocol that will resolve passed paths directly to our canned in-package example data.
2022-05-14 11:11:24 -07:00
Kai Yang
f5c6c7d28f
[Core] Allow failing new tasks immediately while the actor is restarting (#22818)
Currently, when an actor has `max_restarts` > 0 and has crashed, the actor will enter RESTARTING state and then ALIVE. Imagine this scenario: an online service provides HTTP service and the proxy actor receives requests, forwards them to worker actors, and replies to clients with the execution results from worker actors.

```
                                                        -> Worker A (actor)
                                                       /
                                                      /
HTTP requests -------> Proxy (actor with HTTP server) ---> Worker B (actor)
                                                      \
                                                       \
                                                        -> ...
```

For each HTTP request, the proxy picks one worker (e.g. worker A) based on some algorithm, sends the request to it, and calls `ray.get()` to wait for the result. If for some reason the picked worker crashed, Ray will restart the actor, and `ray.get()` will throw an error. The proxy may pick another worker (e.g. worker B) and re-send the request to it. This is OK.

But new requests keep coming. The proxy may pick worker A again. But because worker A is still in RESTARTING state, it's not ready to serve requests. `ray.get()` on subsequent requests sent to worker A will hang until worker A is back online (ALIVE state). The proxy won't be able to reschedule these requests to another worker because currently there's no way to know if worker A is alive or not before sending a request. We can't say worker A is not alive just based on whether `ray.get()` hangs either.

To solve this issue, we change the semantics of `max_task_retries`.

* When max_task_retries is 0 (which is the default value), if the callee actor is in the RESTARTING state, subsequently submitted tasks will fail immediately with a RayActorError. Users can catch the RayActorError and implement their own fallback strategies to improve service availability and mitigate service outages.
* When max_task_retries is not 0, subsequently submitted tasks will be queued on the caller side and we only send them to the callee when the callee actor is back to the ALIVE state.

TODO

- [x] Add test cases.
- [ ] Update docs.
- [x] API change review.
2022-05-14 10:48:47 +08:00
Clark Zinzow
761cfb9238
[Datasets] Add more example data. (#24795)
This PR adds more example data for ongoing feature guide work. In addition to adding the new datasets, this also puts all example data under examples/data in order to separate it from the example code.
2022-05-13 15:07:49 -07:00
Chen Shen
2be45fed5e
Revert "[dataset] Use polars for sorting (#24523)" (#24781)
This reverts commit c62e00e.

See if reverts this resolve linux://python/ray/tests:test_actor_advanced failure.
2022-05-13 12:09:12 -07:00
Jian Xiao
030b99b544
Add a classic yet small-sized ML dataset for demo/documentation/testing (#24592)
To facilitate easy demo/documentation/testing with realistic, small-sized yet ML-familiar data. Have it as a source file with code will make it self-contained, i.e. after user "pip install" Ray, they are all set to run it.

IRIS is a great fit: super classic ML dataset, simple schema, only 150 rows.
2022-05-13 10:25:44 -07:00
Archit Kulkarni
b0f5073b31
[runtime env] Use asyncio lock to prevent concurrent virtualenv creation (#24564) 2022-05-13 10:59:32 -05:00
Jian Xiao
f02a469d36
Drop python 3.6 from Windows build (#24756)
Fix the wheel build failure
2022-05-13 08:50:10 -07:00
Kai Fricke
06ef672699
[ci/docs] Fix broken linkcheck URL (#24777)
The hyperband blogpost URL is broken, link to other blog post
2022-05-13 15:58:36 +01:00
Chen Shen
30f370bf1f
Revert "[core] Move reconnection to RPC layer for GCS client. (#24330)" (#24762)
This reverts commit c427bc54e7.
2022-05-13 00:07:21 -07:00
Qing Wang
2627c7b5bc
[Core] Use async post instead of PostBlocking for concurrency group executor. (#24293)
Aiming to:
1. addressing the bug about concurrency group, see #19593
2. improving the stability of the ray call latency perf in online applications.

we're proposing using async post instead of `PostBlocking` in threadpool.

Note that since we have already had back pressure in the caller side, I believe this change is safe to merge and it doesn't break any behavior.
2022-05-13 11:30:52 +08:00
Qing Wang
b7cc601024
[Ray Collective] Add prefixes for original key to isolate gloo info in different jobs and different groups. (#24290)
This PR uses the job id and group name as the prefix for storing meta information, aiming to provide the isolate ability for different jobs and different groups.

Before this PR, we can't use 2 groups in 1 Ray cluster, and we can not rerun a collective job once the last one is failed at initializing.
2022-05-13 10:06:16 +08:00
Stephanie Wang
c62e00ed6d
[dataset] Use polars for sorting (#24523)
Polars is significantly faster than the current pyarrow-based sort. This PR uses polars for the internal sort implementation if available. No API changes needed.

On my laptop, this makes sorting 1GB about 2x faster:

without polars

$ python release/nightly_tests/dataset/sort.py --partition-size=1e7 --num-partitions=100
Dataset size: 100 partitions, 0.01GB partition size, 1.0GB total
Finished in 50.23415923118591
...
Stage 2 sort: executed in 38.59s

        Substage 0 sort_map: 100/100 blocks executed
        * Remote wall time: 864.21ms min, 1.94s max, 1.4s mean, 140.39s total
        * Remote cpu time: 634.07ms min, 825.47ms max, 719.87ms mean, 71.99s total
        * Output num rows: 1250000 min, 1250000 max, 1250000 mean, 125000000 total
        * Output size bytes: 10000000 min, 10000000 max, 10000000 mean, 1000000000 total
        * Tasks per node: 100 min, 100 max, 100 mean; 1 nodes used

        Substage 1 sort_reduce: 100/100 blocks executed
        * Remote wall time: 125.66ms min, 2.3s max, 1.09s mean, 109.26s total
        * Remote cpu time: 96.17ms min, 1.34s max, 725.43ms mean, 72.54s total
        * Output num rows: 178073 min, 2313038 max, 1250000 mean, 125000000 total
        * Output size bytes: 1446844 min, 18793434 max, 10156250 mean, 1015625046 total
        * Tasks per node: 100 min, 100 max, 100 mean; 1 nodes used

with polars

$ python release/nightly_tests/dataset/sort.py --partition-size=1e7 --num-partitions=100
Dataset size: 100 partitions, 0.01GB partition size, 1.0GB total
Finished in 24.097432136535645
...
Stage 2 sort: executed in 14.02s

        Substage 0 sort_map: 100/100 blocks executed
        * Remote wall time: 165.15ms min, 595.46ms max, 398.01ms mean, 39.8s total
        * Remote cpu time: 349.75ms min, 423.81ms max, 383.29ms mean, 38.33s total
        * Output num rows: 1250000 min, 1250000 max, 1250000 mean, 125000000 total
        * Output size bytes: 10000000 min, 10000000 max, 10000000 mean, 1000000000 total
        * Tasks per node: 100 min, 100 max, 100 mean; 1 nodes used

        Substage 1 sort_reduce: 100/100 blocks executed
        * Remote wall time: 21.21ms min, 472.34ms max, 232.1ms mean, 23.21s total
        * Remote cpu time: 29.81ms min, 460.67ms max, 238.1ms mean, 23.81s total
        * Output num rows: 114079 min, 2591410 max, 1250000 mean, 125000000 total
        * Output size bytes: 912632 min, 20731280 max, 10000000 mean, 1000000000 total
        * Tasks per node: 100 min, 100 max, 100 mean; 1 nodes used

Related issue number

Closes #23612.
2022-05-12 18:35:50 -07:00
Jiajun Yao
8f36e32438
Make sure ray.init() works after AutoscalingCluster.start() (#24613)
Some tests relying on AutoScalingCluster are flaky because ray.init() after AutoscalingCluster.start() is not guaranteed to work. Sometimes, it cannot find any running ray instances.
2022-05-12 17:22:07 -07:00
Jian Xiao
c9f31af27f
[CI] Fix Windows wheel build (#24748) 2022-05-12 16:23:50 -07:00
Stephanie Wang
2fd888ac9d
[core] Skip windows test for adjusting worker OOM score (#24744)
Fixes CI failure introduced in #24623.
2022-05-12 13:01:50 -07:00
Archit Kulkarni
dae7842ac5
[runtime env] Remove plugin name from internal URI (#24706)
This was a holdover from when local resources for URIs were deleted directly from the runtime env agent, and the URI name itself needed to store the information of which plugin it corresponded to so the appropriate plugin's `delete()` function could be called.  After the URI reference refactor, I don't think this is needed anymore.
2022-05-12 11:40:03 -05:00
Amog Kamsetty
c4bf38daa6
[AIR] Add AIR install extra (#24701)
Closes #23439
2022-05-12 09:25:52 -07:00
Jiajun Yao
628f886af4
Don't show usage stats prompt in dashboard if prompt is disabled (#24700) 2022-05-12 07:55:28 -07:00
Antoni Baum
8af1cc1ba1
[Tune] Fix Jupyter reporter with older IPython (#24695)
Fixes `JupyterNotebookReporter` not working with older IPython versions (eg. 5.5.0, installed on Google Colab).
2022-05-12 12:27:35 +01:00
Kai Fricke
b0fa9d6766
[air] Example for Comet ML (#24603)
After #24459, this PR will add similar support for model artifact saving and an example for experiment tracking with Ray AIR for Comet ML.
2022-05-12 12:12:30 +01:00
Kai Fricke
fef1586922
[air/tune] Add get_dataframe() method to result grid, fix config flattening (#24686)
Adds `get_dataframe()` method to pass through experiment analysis to result grid. Also fixes config dictionary returns which previously did not flatten the dict (even though the docstring suggested it would)
2022-05-12 10:02:19 +01:00
Jian Xiao
5f347a6d70
Ubreak the windows wheel building (#24699)
Unbreak the windows wheel building.
2022-05-12 00:23:56 -07:00
Qing Wang
259661042c
[runtime env] [java] Support jars in runtime env for Java (#24170)
This PR supports setting the jars for an actor in Ray API. The API looks like:
```java
class A {
    public boolean findClass(String className) {
      try {
        Class.forName(className);
      } catch (ClassNotFoundException e) {
        return false;
      }
      return true;
    }
}

RuntimeEnv runtimeEnv = new RuntimeEnv.Builder()
    .addJars(ImmutableList.of("https://github.com/ray-project/test_packages/raw/main/raw_resources/java-1.0-SNAPSHOT.jar"))
    .build();
ActorHandle<A> actor1 = Ray.actor(A::new).setRuntimeEnv(runtimeEnv).remote();
boolean ret = actor1.task(A::findClass, "io.testpackages.Foo").remote().get();
System.out.println(ret); // true
```
2022-05-12 09:34:40 +08:00
Yi Cheng
c427bc54e7
[core] Move reconnection to RPC layer for GCS client. (#24330)
This PR support reconnection of the GCS client in gRPC channel layer. Previously this is implemented in the application layer:

- Health check is in the application layer by starting a new channel.
- Monitor the GCS address change and do resubscribe.
- Always retry the failed request and do reconnection in case of a failure.

However, there are several issues with this approach:

- We need service to discover for GCS address change. 
- Monitor is too heavy since it always creates a channel.
- Reconnection is a blocking call that prevents the code from running.

This new approach moves the reconnection to gRPC layer directly to fix these issues.

- DNS name resolution is done by gRPC so we don't need to write this.
- Health check is done by checking the channel state.
- Queue the failed call and retry once GCS is up so that it's not a blocking call.
2022-05-11 16:27:22 -07:00
Sihan Wang
c5bfe1d694
[Serve] Add deployment graph cookbook (#24524) 2022-05-11 16:24:55 -07:00
Stephanie Wang
6ea825c294
[core] Adjust worker OOM scores to prioritize the raylet during memory pressure (#24623)
Under heap memory pressure, the raylet is often killed by the OS OOM killer. This is bad because it can cause whole system crashes and it is difficult to find the error afterwards. This PR adjusts the OOM score for any workers that the raylet spawns so that the OOM killer will hopefully prioritize killing those instead of the raylet.
2022-05-11 15:32:23 -07:00
Antoni Baum
47edb497c5
[data] More informative exceptions in block impl (#24665) 2022-05-11 14:53:40 -07:00
Archit Kulkarni
93d61b6d48
[runtime_env] Add debug prints to serve:test_runtime_env which is flaky (#24670) 2022-05-11 16:03:46 -05:00
Chris K. W
11650b56e2
[client] Chunk ClientTask's (#24555)
Adds support for chunking large schedule calls. Needed to support ray.remote calls with more than 2GiB of arguments.

Deprecates the args and kwargs fields of ClientTask and replaces them with a data field that contains a tuple of the serialized args and kwargs fields, which can be chunked and reassembled more easily using the same logic as PutRequest's.
2022-05-11 13:37:52 -07:00
YoelShoshan
5a43b075bc
Add screen custom log file support (#24461)
A simple way to redirect remote job output to a custom file is extremely useful.
Especially if it does not require any code changes for the user, and especially if it captures all output and not limited only to python logging.

When the PR will be merged, the user will be able to do the following (for example):

ray submit some_cluster_config.yaml example_runnable_script.py --screen --extra-screen-args "-Logfile /gpfs/usr/someone/ray/output_log.txt"
which will, in addition to creating the screen session, also output (continuously) to custom text file.
It allows additional flexibility, for example, the user will be able to choose custom screen session name etc.
2022-05-11 12:16:47 -07:00
Dmitri Gekhtman
c6d3ffb133
[KubeRay][NodeProvider] Ignore pods with deletionTimestamp. (#24590)
Closes #24514 by filtering out pods with metadata.deletionTimestamp set in the KuberayNodeProvider.

Adds some e2e test logic to confirm reasonable behavior when Ray worker pod termination hangs.

Also, a bit of code cleanup -- defining constants, adding to doc strings, etc.
2022-05-11 10:49:34 -07:00
Makan Arastuie
5e23d9e298
[Tune] Bug fix - HEBOSearch - accept iterables as a config search space (#24678)
HEBOSearch algorithm currently fails if the config search space contains a categorical parameter where each category is an iterable.

For instance, choosing the hidden layers of a NN:
` hyperparam_search_space = {'hidden_sizes': tune.choice([[512, 256, 128], [1024, 512, 256]])}`

This is due to the creation of the Pandas DataFrame with HEBO suggested parameters, without explicitly telling Pandas that the hyper-parameter suggestion is a single row of data while the index is being defined as a single row. This results in an exception such as "ValueError: Length of values (3) does not match length of index (1)".

Co-authored-by: Makan Arastuie <makan.arastuie@seagate.com>
2022-05-11 18:29:50 +01:00
Antoni Baum
e95207a298
[data] Expose drop_last in to_tf (#24666) 2022-05-11 09:46:08 -07:00
Antoni Baum
aaead7e3b3
[AIR] Add load_checkpoint functions to Trainers (#24518)
Co-authored-by: Amog Kamsetty <amogkam@users.noreply.github.com>
2022-05-11 09:45:50 -07:00
Eric Liang
4c6fccafe6
Add a small timeline delay (#24673) 2022-05-10 21:04:40 -07:00