Commit graph

6609 commits

Author SHA1 Message Date
Siyuan (Ryans) Zhuang
6dc74f5808
[workflow] Deprecate "workflow.step" [Part 3 - events] (#23796)
* update workflow events
2022-04-08 16:09:55 -07:00
Jiajun Yao
e910f0abcf
[Test] Don't send usage data to server for unit tests (#23800)
There are two tests that are accidentally sending usage data to the server. This pr fixes that.
2022-04-08 16:02:30 -07:00
Amog Kamsetty
029517a037
[Train] Fix train.torch.get_device() for fractional GPU or multiple GPU per worker case (#23763)
Using the local rank as the device id only works if there is exactly 1 GPU per worker. Instead we should be using ray.get_gpu_ids() to determine which GPU device to use for the worker.
2022-04-08 14:35:06 -07:00
xwjiang2010
615bb7a503
[tuner] add kwargs to be compatible with tune.run offerings. (#23791) 2022-04-08 14:30:40 -07:00
Qing Wang
42b4cc4e72
[ray collective] Use Ray internal kv for gloo group. (#23633)
Ray use gcs in memory store by default instead of Redis, which cause gloo group doesn't work by default.
In this PR, we use Ray internal kv for the store of gloo group to replace the RedisStore by default, to make gloo group work well.

This PR depends on another PR in pygloo https://github.com/ray-project/pygloo/pull/10
2022-04-08 19:39:58 +08:00
Keshi Dai
c143391b34
Expose A100 in accelerators module (#23751)
NVIDIA_TESLA_A100 is added here but it's not exposed in accelerators module's __init__ file.
2022-04-07 11:29:27 -07:00
xwjiang2010
7c67a4f1d0
[tuner] update tuner doc (#23753) 2022-04-07 11:10:17 -07:00
Antoni Baum
434d457ad1
[tune] Improve missing search dependency info (#23691)
Replaces FLAML searchers with a dummy class that throws an informative error on init if FLAML is not installed, removes ConfigSpace import in BOHB example code, adds a note to examples using external dependencies.
2022-04-07 08:53:27 -07:00
shrekris-anyscale
a6bcb6cd1e
[serve] Create application.py (#23759)
The `Application` class is stored in `api.py`. The object is relatively standalone and is used as a dependency in other classes, so this change moves `Application` (and `ImmutableDeploymentDict`) to a new file, `application.py`.
2022-04-07 10:34:24 -05:00
shrekris-anyscale
0902ec537d
[serve] Include full traceback in deployment update error message (#23752)
When deployments fail to update, [Serve sets their status to UNHEALTHY and logs the error message](46465abd6d/python/ray/serve/deployment_state.py (L1507-L1511)). However, the message lacks a traceback, making it impossible to find what caused it. [For example](https://console.anyscale.com/o/anyscale-internal/projects/prj_2xR6uT6t7jJuu1aCwWMsle/clusters/ses_SfGPJq8WWJUhAvmHHsDgJWUe?command-history-section=command_history):

```
File "/home/ray/anaconda3/lib/python3.7/site-packages/ray/serve/api.py", line 328, in _wait_for_deployment_healthy
    raise RuntimeError(f"Deployment {name} is UNHEALTHY: {status.message}")
RuntimeError: Deployment echo is UNHEALTHY: Failed to update deployment:
'>' not supported between instances of 'NoneType' and 'int'.
```

It's not clear where `'>' not supported between instances of 'NoneType' and 'int'.` is being triggered.

The change includes the full traceback for this type of update failure. The new status message is easier to debug:

```
File "/Users/shrekris/Desktop/ray/python/ray/serve/api.py", line 328, in _wait_for_deployment_healthy
    raise RuntimeError(f"Deployment {name} is UNHEALTHY: {status.message}")
RuntimeError: Deployment A is UNHEALTHY: Failed to update deployment:
Traceback (most recent call last):
  File "/Users/shrekris/Desktop/ray/python/ray/serve/deployment_state.py", line 1503, in update
    running_replicas_changed |= self._check_and_update_replicas()
  File "/Users/shrekris/Desktop/ray/python/ray/serve/deployment_state.py", line 1396, in _check_and_update_replicas
    a = 1/0
ZeroDivisionError: division by zero
```

(I forced a divide-by-zero error to get this traceback).
2022-04-07 10:34:00 -05:00
shrekris-anyscale
64d98fb385
[serve] Add unit tests and better error messages to _store_package_in_gcs() (#23576)
This change adds new unit tests and error message to _store_package_in_gcs(). In particular, it tests the function's behavior when it fails to connect to the GCS.
2022-04-06 17:34:10 -07:00
Kai Fricke
d27e73f851
[ci] Pin prometheus_client to fix current test outages (#23749)
What: Pins prometheus_client to < 0.14.0, hopefully fixing today's CI outages
Why: New version of the python client (https://github.com/prometheus/client_python/releases) breaks our CI
2022-04-06 14:22:22 -07:00
Amog Kamsetty
8becbfa927
[Train] MLflow start run under correct experiment (#23662)
Start Mlflow run under correct mlflow experiment
2022-04-06 11:50:32 -07:00
Siyuan (Ryans) Zhuang
46465abd6d
[workflow] Deprecate "workflow.step" [Part 2 - most nested workflows] (#23728)
* remove workflow.step

* convert examples
2022-04-06 00:47:43 -07:00
Kai Fricke
c0e38e335c
Revert "Revert "[air] Better exception handling"" (#23733)
This reverts commit 5609f438dc.
2022-04-05 21:45:24 -07:00
Kai Fricke
5609f438dc
Revert "[air] Better exception handling (#23695)" (#23732)
This reverts commit fb50e0a70b.
2022-04-05 20:20:40 -07:00
xwjiang2010
99f64821b1
[tune] add tuner test (#23726)
Adds test for TorchTrainer+Tuner
2022-04-05 19:42:51 -07:00
Kai Fricke
fb50e0a70b
[air] Better exception handling (#23695)
What: Raise meaningful exceptions when invalid parameters are passed.
Why: We want to catch invalid parameters and guide users to use the API in the correct way.
2022-04-05 19:11:55 -07:00
Antoni Baum
252596af58
[AIR] Add config to Result, extend ResultGrid.get_best_config (#23698)
Adds a dynamic property to easily obtain `config` dict from `Result`, extends the `ResultGrid.get_best_config` method for parity with `ExperimentAnalysis.get_best_trial` (allows for using of mode and metric different to the one set in the Tuner).
2022-04-05 16:08:05 -07:00
Stephanie Wang
9813f2cce4
[datasets] Unify Datasets primitives on a common shuffle op (#23614)
Currently Datasets primitives repartition, groupby, sort, and random_shuffle all use different internal shuffle implementations. This PR unifies them on a single internal ShuffleOp class. This class exposes static methods for map and reduce which must be implemented by the specific higher-level primitive. Then the ShuffleOp.execute method implements a simple pull-based shuffle by submitting one map task per input block and one reduce task per output block.

Closes #23593.
2022-04-05 15:53:28 -07:00
Kai Fricke
dc994dbb02
[tune] Add RemoteTask based sync client (#23605)
If rsync/ssh is not available (as in kubernetes setups), Tune previously had no fallback mechanism to synchronize trial directories to the driver. This PR introduces a `RemoteTaskSyncer` trial syncer that uses ray remote tasks to ship file contents between nodes. The implementation utilizes tarfile to compress files for transfer, and it only transfers files that differ between the source and target directory to minimize network bandwidth usage.

The trial syncer works as follows:

1. It collects information about existing files in the target directory. This directory could be remote (when syncing up) or local (when syncing down).
2. It then schedules a `pack` task on the source node. This will always be a remote task so the future can be passed to the unpack task. The pack task will only pack files that are not existent or different in the target directory into a tarfile, which is returned as a bytes string
3. An `unpack` task in scheduled on the target node. This will always be a remote task so the future can be awaited in a call to `wait()`

A test is added to ensure that only modified files are transferred on subsequent sync ups/downs.

Finally, minor changes are made to the `Syncer`/`NodeSyncer` classes to allow passing `(ip, path)` tuples rather than rsync-style remote paths.
2022-04-05 21:35:25 +01:00
Chris K. W
9b79048963
Update error message for @ray.method (#23471)
Updates @ray.method error message to match the one for @ray.remote. Since the client mode version of ray.method is identical to the regular ray.method, deletes the client mode version and drops the client_mode_hook decorator (guessing that the client copy was added before client_mode_hook was introduced).

Also fixes what I'm guessing is a bug that doesn't allow both num_returns and concurrency_group to be specified at the same time (assert len(kwargs) == 1).

Closes #23271
2022-04-05 11:12:55 -07:00
Stephanie Wang
1c972d5d2d
[core] Spill at least the object fusion size instead of at most (#22750)
Copied from #22571:

Whenever we spill, we try to spill all spillable objects. We also try to fuse small objects together to reduce total IOPS. If there aren't enough objects in the object store to meet the fusion threshold, we spill the objects anyway to avoid liveness issues. However, currently we spill at most the object fusion size when instead we should be spilling at least the fusion size. Then we use the max number of fused objects as a cap.

This PR fixes the fusion behavior so that we always spill at minimum the fusion size. If we reach the end of the spillable objects, and we are under the fusion threshold, we'll only spill it if we don't have other spills pending too. This gives the pending spills time to finish, and then we can re-evaluate whether it's necessary to spill the remaining objects. Liveness is also preserved.

Increases some test timeouts to allow tests to pass.
2022-04-05 10:57:42 -07:00
Antoni Baum
ca6dfc8bb7
[AIR] Interface for HuggingFaceTorchTrainer (#23615)
Initial draft of the interface for HuggingFaceTorchTrainer.

One alternative for limiting the number of datasets in datasets dict would be to have the user pass train_dataset and validation_dataset as separate arguments, though that would be inconsistent with TorchTrainer.
2022-04-05 10:32:13 -07:00
liuyang-my
bdd3b9a0ab
[Serve] Unified Controller API for Cross Language Client (#23004) 2022-04-05 09:20:02 -07:00
jon-chuang
9c950e8979
[Core] Placement Group: Fix Flakey Test placement_group_test_5 and Typo (#23350)
placement_group_test_5 is flakey. Reason is requesting PG with exact object store memory as node. If object store has object, then PG scheduling fails.

Also fix bug - typo.
2022-04-05 05:33:43 -07:00
Gagandeep Singh
11baa22c1e
Split test_advanced_n.py and enabled cluster tests (#23524) 2022-04-05 01:34:57 -07:00
Gagandeep Singh
8c87117bc3
Uniformly distributed tasks among actors to utilize full concurrency (#23416)
* Uniformly distributed tasks among actors to utilize full concurrency

* Added test to ensure all tasks are launched at the same time

* Applied linting format
2022-04-05 01:05:41 -07:00
Matti Picus
96948a4a30
WINDOWS: skip flaky test (#23557)
Continuation of #23462 to try to get test_ray_init to pass consistently in CI. The skipped test passes locally, so only skip it on CI.
2022-04-05 00:56:43 -07:00
Jiajun Yao
5f37231842
Remove yapf dependency (#23656)
Yapf has been replaced by black.
2022-04-04 21:50:04 -07:00
Clark Zinzow
08159eb668
[Datasets] Disallow callable classes for task compute strategy. (#23708) 2022-04-04 21:12:36 -07:00
Siyuan (Ryans) Zhuang
ae86fb258e
[workflow] Fix workflow continuation resolving (#23682)
* update test

* return StaticWorkflowRef

* reformat test
2022-04-04 17:39:24 -07:00
Amog Kamsetty
4530349506
[AIR] Set name of Trainable to match with Trainer #23697 2022-04-04 16:23:21 -07:00
shrekris-anyscale
4aaa895137
[runtime_env] Reorganize tests in test_runtime_env_working_dir_2.py and test_runtime_env_working_dir_3.py (#23618) 2022-04-04 17:35:49 -05:00
Kai Fricke
b3b1498eba
[tune] Beautify Optional typehints (#23692)
What: Changes `Union[None, type1, ..., typeN]` type hints to `Optional[type1, ..., typeN]`
Why: Better readability, consistency across library, consistency with code style guides.
2022-04-04 19:48:34 +01:00
Edward Oakes
09123e3452
[serve][minor] Remove "statuses" key from serve status output (#23642) 2022-04-04 11:11:26 -05:00
Kai Fricke
7e0c63ab9c
[tune] Simplify experiment tag formatting, clean directory names (#23672)
Experiment tags are not always rendered in a sane way for all operating systems. For instance,  a config of

```
            "a": tune.choice([(3, 4), (5, 6)]),
            "b": tune.choice([[7, 8], [6, 5]]),
```

will lead to an experiment dir like `lambda_53737_00000_0_a=_3, 4_,b=[7, 8]_2022-04-02_10-21-27/`. This can lead to problems with utilities such as gsutil (which misinterprets some characters as wildcards, see #23670), but also with e.g. MacOS which doesn't like `[` brackets in filenames. 

This PR adds an improvement to the `_clean_value` function used to sanitize values. We specify a valid alphabet which includes a limited set of characters that is broadly usable in most operating systems. We also simplify the `format_vars` function - even though it was previously a bit more sophisticated in handling list items, this was error-prone, and can be replaced in favor of a better readable and simpler implementation that yields the same results in almost all cases.
2022-04-04 16:05:47 +01:00
Andrew Bauer
3e7c8231a8
Apply 'Incorrect pickles for subclasses of generic classes #448' from cloudpickle (#22553)
Co-authored-by: Chen Shen <scv119@gmail.com>
2022-04-04 00:06:39 -07:00
shrekris-anyscale
071e1dd20f
[serve] Create deployment.py and deployment_graph.py (#23578)
`api.py` has accumulated classes and functions that aren't purely public APIs, causing circular dependencies. This change pulls `Deployment` and deployment graph-related features out of `api.py` and puts them in two new files: `deployment.py` and `deployment_graph.py`.
2022-04-01 13:40:13 -07:00
shrekris-anyscale
d4747d28eb
[serve] Set "memory" to None in ray_actor_options by default (#23619)
* Make default memory 1

* Add test to validate that ReplicaConfig's default memory cannot be lower than minimum

* Add a new option to memory_omitted_options

* Update if branch in test_replica_config_default_memory_minimum

* Make memory default value None
2022-04-01 09:14:44 -07:00
Kai Fricke
fe27dbcd9a
[air/release] Improve file packing/unpacking (#23621)
We use tarfile to pack/unpack directories in several locations. Instead of using temporary files, we can just use io.BytesIO to avoid unnecessary disk writes.

Note that this functionality is present in 3 different modules - in Ray (AIR), in the release test package, and in a specific release test. The implementations should live in the three modules independently, so we don't add a common utility for this (e.g. the ray_release package should be independent of the Ray package).
2022-04-01 07:38:14 -07:00
Lingxuan Zuo
4510c2df90
[Python] export cython module for external project (#23579)
A lot of cython data types have been defined in ray cython module, but outside project cannot reuse these since ray doesn't export all of *.pxd files.

To fix mobius python building error (https://github.com/ray-project/mobius/runs/5740167581?check_suite_focus=true) : no found ray common.pxd, etc. , 

According to cython document https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html
we might add this package_data parameter in setup.py
```python
setup(
    package_data = {
        'my_package': ['*.pxd'],
        'my_package/sub_package': ['*.pxd'],
    },
    ...
)
```

Co-authored-by: 林濯 <lingxuzn.zlx@antgroup.com>
2022-04-01 10:31:33 +08:00
xwjiang2010
378b66984f
[air] reduce unnecessary stacktrace (#23475)
There are a few changes:
1. Between runner thread and main thread: The same stacktrace is raised in `_report_thread_runner_error` in main thread. So we could spare this raise in runner thread.
2. Between function runner and Tune driver: Do not wrap RayTaskError in TuneError.
3. Within Tune driver code: Introduces a per errored trial error.pkl and uses that to populate ResultGrid.

Plus some cleanups to facilitate propagating exception in runner and executor code.

Final stacktrace looks like: (omitted)

In Tune, we are capturing `traceback.format_exc` at the time the exception is caught and just pass the string around. This PR slightly changes that only in the case of when RayTaskError is raised, and we pass that object around.
It may be worthwhile to settle down on a practice of error handling in Tune in general.
I am also curious to learn how other ray library does that and any good lessons to learn. 

In particular, we should watch out for memory leaking in exception handling. Not sure if it is still a problem in python 3, but here are some articles I came across for reference
https://cosmicpercolator.com/2016/01/13/exception-leaks-in-python-2-and-3/
2022-03-31 22:59:58 +01:00
Andrew Sedler
853f6d6de3
[Bug][Tune] Fix bugs that cause hanging PAUSED trials with PopulationBasedTrainingScheduler (#23472)
As discussed in #23424, the synch=True mode of PopulationBasedTrainingScheduler is (1) not compatible with burn_in_period and (2) causes the presence of TERMINATED trials to hang PAUSED trials indefinitely.

This change addresses (1) by setting the initial _next_perturbaton_sync to the max of burn_in_period and perturbation_interval in the constructor and (2) by checking only whether live trials have reached the _next_perturbation_sync before resuming PAUSED trials.
2022-03-31 08:33:51 -07:00
Chen Shen
944e8e1053
Revert "[Python Worker] load actor dependency without importer thread (#23383)" (#23601)
This reverts commit d1ef498638.
2022-03-30 15:45:00 -07:00
Kai Fricke
3b3f271c3c
[tune] Fix tensorflow distributed trainable docstring (#23590)
The current docstring was copied from horovod and still refers to it.
2022-03-30 11:36:45 -07:00
Kai Fricke
e8abffb017
[tune/release] Improve Tune cloud release tests for durable storage (#23277)
This PR addresses recent failures in the tune cloud tests.

In particular, this PR changes the following:

    The trial runner will now wait for potential previous syncs to finish before syncing once more if force=True is supplied. This is to make sure that the final experiment checkpoints exist in the most recent version on remote storage. This likely fixes some flakiness in the tests.
    We switched to new cloud buckets that don't interfere with other tests (and are less likely to be garbage collected)
    We're now using dated subdirectories in the cloud buckets so that we don't interfere if two tests are run in parallel. Objects are cleaned up afterwards. The buckets are configured to remove objects after 30 days.
    Lastly, we fix an issue in the cloud tests where the RELEASE_TEST_OUTPUT file was unavailable when run in Ray client mode (as e.g. in kubernetes).

Local release test runs succeeded.

https://buildkite.com/ray-project/release-tests-branch/builds/189
https://buildkite.com/ray-project/release-tests-branch/builds/191
2022-03-30 09:28:33 -07:00
Eric Liang
5aead0bb91
Warn if the dataset's parallelism is limited by the number of files (#23573)
A common user confusion is that their dataset parallelism is limited by the number of files. Add a warning if the available parallelism is much less than the specified parallelism, and tell the user to repartition() in that case.
2022-03-29 18:54:54 -07:00
xwjiang2010
6443f3da84
[air] Add horovod trainer (#23437) 2022-03-29 18:12:32 -07:00
Matti Picus
e58b784ac7
WINDOWS: fix pip activate command (#23556)
Continuation of #22449 

Fix pip activation so something like this will not crash
```
ray.init(runtime_env={"pip": ["toolz", "requests"]})
```

Also enable test that hit this code path.
2022-03-29 17:51:20 -07:00