Commit graph

7107 commits

Author SHA1 Message Date
Siyuan (Ryans) Zhuang
ab44133fba
[Workflow] Replace StepID with TaskID (#26232) 2022-06-30 16:40:58 -07:00
shrekris-anyscale
010a3566e6
[Serve] Allow and remove trailing slashes in Ray submission address (#26093) 2022-06-30 16:04:53 -07:00
Kai Fricke
ce0cc8ea53
[tune] Improve custom func checkpointing example (#26230)
Avoid using internal constants in this example.
2022-06-30 15:53:12 -07:00
Eric Liang
3b1948ed45
[air] Randomize block order by default to avoid hotspots (#25870)
Enable block order randomization by default to avoid ingest hotspots when running concurrent trials.
2022-06-30 13:38:03 -07:00
xwjiang2010
ac831fded4
[air] update documentation to use session.report (#26051)
Update documentation to use `session.report`.

Next steps:
1. Update our internal caller to use `session.report`. Most importantly, CheckpointManager and DataParallelTrainer.
2. Update `get_trial_resources` to use PGF notions to incorporate the requirement of ResourceChangingScheduler. @Yard1 
3. After 2 is done, change all `tune.get_trial_resources` to `session.get_trial_resources`
4. [internal implementation] remove special checkpoint handling logic from huggingface trainer. Optimize the flow for checkpoint conversion with `session.report`.

Co-authored-by: Antoni Baum <antoni.baum@protonmail.com>
2022-06-30 10:37:31 -07:00
shrekris-anyscale
20c6c0725a
[Serve] Deprecate deployment's prev_version field (#26217) 2022-06-30 09:59:37 -07:00
xwjiang2010
3ffff53428
[tune] Fix stacktrace (#26220)
Reland the original change. But without changing the test_utils so that other tests are not affected...
2022-06-30 07:38:36 -07:00
ZhuSenlin
c5de057d1d
[Core][Enable gcs scheduler 3/n] integrate placement group with gcs scheduler (#24842)
## Why are these changes needed?
1. Now, bundle resources are deducted from the cluster resources on the `GCS` side when all Commit requests sent by `GCS` to `Raylet` are returned. Actually, the bundle resources should be deducted before sending `PreprareResources` by `GCS` to `Raylet`, so that the scheduling of actor based on `GCS` could use more fresh resources. BTW, putting the deduction before `PrepareResources` or after reply of all `CommitResources` has no impact on `Raylet` scheduling.

2. The `GcsResourceManager::UpdateResources` and `GcsResourceManager::DeleteResources` could be deleted to simplify `GcsResourceManager`.
   - `GcsResourceManager::UpdateResources` is only used when `GcsPlacementGroupScheduler::CommitAllBundles`, we could update the node resources (commit bundle resources) in `GcsPlacementGroupScheduler` directly, and I think it's unnecessary to put these resources to storage (the resources could be replayed by placement group)
   - `GcsResourceManager::DeleteResources` is only used when `GcsPlacementGroupScheduler::CancelResourceReserve` which is invoked by `GcsPlacementGroupScheduler::DestroyPlacementGroupPreparedBundleResources` and `GcsPlacementGroupScheduler::DestroyPlacementGroupCommittedBundleResources`. in fact, the `GcsPlacementGroupScheduler::ReturnBundleResources` will be called wherever these two functions are used, so I think the `GcsResourceManager::DeleteResources` is redundant. BTW, I think it's unnecessary to put the change of resources to storage (the resources could be replayed by placement group).

3.  The `gcs_table_storage_` is useless as both `GcsResourceManager::UpdateResources` and `GcsResourceManager::DeleteResources` is removed, so it could be removed too.

4. The `ray_gcs_new_resource_creation_latency_ms_sum` could be removed too as the `GcsResourceManager::UpdateResources` is removed.

Co-authored-by: 黑驰 <senlin.zsl@antgroup.com>
2022-06-30 02:04:39 -07:00
Guyang Song
122ec5e52f
[runtime env] plugin refactor[2/n]: support json schema validation (#26154) 2022-06-30 16:09:23 +08:00
Siyuan (Ryans) Zhuang
ddd63aba77
[workflow] Major refactoring - new async workflow executor (#25618)
* major workflow refactoring
2022-06-29 20:31:40 -07:00
Eric Liang
636a9c1291
[data] randomize_block_order() not compatible with stage fusion
Why are these changes needed?
Per the discussion in #26057, fix the stage fusion issue by re-ordering the randomize stage past any 1-1 stages.

Closes #26057
2022-06-29 18:16:03 -07:00
Stephanie Wang
1a8fd8a72b
Revert "[tune] fix stacktrace. (#26135)" (#26216)
This reverts commit e85247b5dd.
2022-06-29 17:00:31 -07:00
shrekris-anyscale
d1c9aaad33
[Serve] Set num_cpus to 0 in run_graph() task (#26177) 2022-06-29 16:35:33 -07:00
Dmitri Gekhtman
66ea76da1b
[kuberay] Logging-related autoscaler stability improvement.
The autoscaler container writes logs to a directory set up by the Ray container.
This PR moves the logic that sets up autoscaler logging so that it is done after the Ray container is ready.

This PR also changes things so that the autoscaler process exits after hitting 5 total exceptions. Kubernetes will then restart the autoscaler. The idea here is to ensure the autoscaler is able to restart cleanly in long-running deployments of Ray.
2022-06-29 13:18:13 -07:00
xwjiang2010
e85247b5dd
[tune] fix stacktrace. (#26135)
explicitly pass in `exc_info` to `logger.exception` when it's outside of try-catch blob.
2022-06-29 11:06:43 -07:00
Philipp Moritz
224ec2e45a
Add typing_extensions requirement to core requirements (#26169)
Since https://github.com/ray-project/ray/pull/25999 we need typing_extensions. It is a very light requirement (no transitive dependencies and small package) so that should be ok.

Considered alternative: Make it optional -- but that would make the typing code more brittle, and prevent us from using more typing in the future.
2022-06-29 09:37:02 -07:00
matthewdeng
4a21dc31ae
[air] update DummyTrainer to handle DatasetPipelines (#26175)
1. Update `DummyTrainer` to take `num_epochs` instead of `runtime_seconds`.
    1. Ray Train expects equal number of calls to `train.report()`. Different workers may run at different speeds and terminate after different epoch numbers, which causes an error.
2. Add `generate_epochs` to support `DatasetPipeline` when `use_stream_api` is True.
3. Update `__main__` code to support testing different configurations.
2022-06-29 09:32:57 -07:00
Antoni Baum
dc7ed086a5
[AIR] More checkpoint configurability, Result extension (#25943)
This PR:
* Allows the user to set `keep_checkpoints_num` and `checkpoint_score_attr` in `RunConfig` using the `CheckpointStrategy` dataclass
* Adds two new fields to the `Result` object - `best_checkpoints` - a list of saved best checkpoints as determined by `CheckpointingConfig`.
2022-06-29 08:23:29 -07:00
Alex Wu
a0b6781a64
[docs] ray.remote(object_store_memory) is for actors only (#26161)
We explicitely disallow scheduling tasks based on object store memory, so we should state that in the docs

cc @scottsun94 

```
>>> import ray
>>> @ray.remote(object_store_memory=100)
... def foo():
...  pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alex/anyscale/ray/python/ray/worker.py", line 2479, in _make_remote
    ray_option_utils.validate_task_options(options, in_options=False)
  File "/Users/alex/anyscale/ray/python/ray/_private/ray_option_utils.py", line 191, in validate_task_options
    task_options[k].validate(k, v)
  File "/Users/alex/anyscale/ray/python/ray/_private/ray_option_utils.py", line 33, in validate
    raise ValueError(self.error_message_for_value_constraint)
ValueError: Setting 'object_store_memory' is not implemented for tasks
```

Co-authored-by: Alex Wu <alex@anyscale.com>
2022-06-28 20:24:48 -07:00
SangBin Cho
8837a4593f
[State Observability] Truncate data when there are too many entries to return (#26124)
## Why are these changes needed?

This PR adds data truncation when there are more than N number of entries. The policy is as follow;

By default, we return 100 entries at max. Users can adjust this value, but we won't allow to increase more than 10K.

By default, all internal RPCs truncate data if it's > 10K. 

For distributed sources, we query each source with 10K limit and we apply limit again at the end. 

## Related issue number

Closes https://github.com/ray-project/ray/issues/25984#issue-1279280673
Part of https://github.com/ray-project/ray/issues/25718#issue-1268968400
2022-06-28 18:33:57 -07:00
Antoni Baum
128f9e5664
[AIR] Move integration logging callbacks to AIR (#26126)
As the integration logging callbacks are commonly used with AIR Trainers, they should be moved from the tune package to the air package. The old imports will still work, but raise a deprecation warning.
2022-06-28 17:25:19 -07:00
Stephanie Wang
c9be251b7a
Revert "[AIR][Serve] Rename ModelWrapperDeployment -> PredictorDeployment (#25962)" (#26176)
This reverts commit 68692b3464.
2022-06-28 17:07:07 -07:00
SangBin Cho
def02bd4c9
Revert Revert "[Observability] Fix --follow lost connection when it is used for > 30 seconds" #26162 (#26163)
* Revert "Revert "[Observability] Fix --follow lost connection when it is used for > 30 seconds (#26080)" (#26162)"

This reverts commit 3017128d5e.
2022-06-28 16:07:32 -07:00
Archit Kulkarni
21760fd3ba
[runtime env] [CI] Use wait_for_condition in working_dir GC test instead of hardcoded sleep (#25983) 2022-06-28 11:51:29 -07:00
Amog Kamsetty
17766bc8b0
[AIR] Update KerasCallback to work with TensorflowPredictor (#26089)
The KerasCallback saves the model checkpoint as a file. However, for the saved checkpoint to work with TensorflowPredictor, the model weights needs to be saved under the MODEL_KEY in a dict format.
2022-06-28 11:22:42 -07:00
zcin
da5366f5f5
[serve] Set status message if deployment pending for too long (#25861)
If a ray cluster does not have enough resources for a serve deployment, the deployment will be stuck at `updating` status. This change will set the `message` field when allocations/initializations of actors have been pending for too long.

Co-authored-by: shrekris-anyscale <92341594+shrekris-anyscale@users.noreply.github.com>
2022-06-28 11:21:52 -07:00
Simon Mo
68692b3464
[AIR][Serve] Rename ModelWrapperDeployment -> PredictorDeployment (#25962) 2022-06-28 10:26:10 -07:00
Stephanie Wang
3017128d5e
Revert "[Observability] Fix --follow lost connection when it is used for > 30 seconds (#26080)" (#26162)
This reverts commit 2d58bd5a50.
2022-06-28 10:04:58 -07:00
SangBin Cho
68336abf13
[State Observability] Support --detail flag. (#26071)
## Why are these changes needed?

This PR adds --detail flag to the list APIs.
2022-06-28 07:56:44 -07:00
SangBin Cho
2d58bd5a50
[Observability] Fix --follow lost connection when it is used for > 30 seconds (#26080)
## Why are these changes needed?

This PR fixes the issue where --follow lost connection when it is used for > 30 seconds because the gRPC timeout is configured to be 30 seconds, and we don't reset it when --follow is set.

This fixes the issue by setting timeout=None when keepalive==True

## Related issue number

Closes https://github.com/ray-project/ray/issues/25721
2022-06-28 05:48:25 -07:00
SangBin Cho
4b957e99b5
[State Observability] != predicate for filtering. (#26079)
## Why are these changes needed?

This PR implements `!=` predicate for filtering. As a result of this PR, two APIs are changed.

```
--filter key value -> --filter "key=val" or ---filter "key!=val"

list_actors(filters=[(key, val), (key2, val2)]) -> list_actors(filters=[(key, "=", val), (key2, "=", val2)])
```
2022-06-28 05:42:19 -07:00
Guyang Song
58bfad84d3
[runtime env] plugin refactor[1/n] (#26077) 2022-06-28 14:09:05 +08:00
Ricky Xu
44daf3ecd7
[Core][State Observability] Get API using List endpoints + filtering on ids (#25894)
## Why are these changes needed?
This is a first implementation of GET APIs for

nodes
actors
placement groups
workers
tasks
objects
E.g.

# CLI
(dev) ➜  ray git:(ricky/obs-get) ray get nodes cab26304d105caa6f2100908f7b461ef9ed244984ec30b4b46f953f9
---
node_id: cab26304d105caa6f2100908f7b461ef9ed244984ec30b4b46f953f9
node_ip: 172.31.47.143
node_name: 172.31.47.143
resources_total:
    CPU: 8.0
    memory: 16700517582.0
    node:172.31.47.143: 1.0
    object_store_memory: 8350258790.0
state: ALIVE


# Python 
from ray.experimental.state.api import get_node
from ray.experimental.state.common import NodeState

node :NodeState = get_node(<id>)
print(node)

We currently do not support getting specific resources by id for 'jobs' and 'runtime-envs'

jobs: it is not exposing id to be queried easily yet
runtime envs: it doesn't have an id associated.

TODO:
it uses list endpoints + filtering as for now, future iterations will implement GET-specific endpoints and interaction with raylet/GCS with point query APIs.
Unit testing for state_manager for GET endpoints when implemented.
Getting jobs by id
2022-06-27 17:14:29 -07:00
shrekris-anyscale
66650cdadb
[Serve] Remove serve.start() in run_graph task (#26096) 2022-06-27 09:44:36 -07:00
shrekris-anyscale
607c276e43
[Serve] Add cosmetic improvements to serve build (#25935) 2022-06-27 09:42:20 -07:00
Ricky Xu
3d8ca6cf0f
[Core][cli][usability] ray stop prints errors during graceful shutdown (#25686)
Why are these changes needed?
This is to address false alarms on subprocesses exiting when killed by ray stop with SIGTERM.

What has been changed?
Added signal handlers for some of the subprocesses:
dashboard (head)
log monitor
ray client server
Changed the --block semantics and prompt messages.

Related issue number
Closes #25518
2022-06-27 08:14:59 -07:00
Dmitri Gekhtman
1055eadde0
[Dashboard] Fix dashboard RAM and CPU with cgroups2 (#25710)
Closes #25283.

The dashboard shows inaccurate memory and cpu data when run inside of a docker container, in particular when using cgroups v2. This PR fixes that.
2022-06-26 14:01:26 -07:00
Dmitri Gekhtman
0d5131ba37
[Autoscaler][minor] Improve shutdown handler, add retries to KubeRay config fetch (#25904)
Uses a Monitor attribute in the shutdown handler instead of an args attribute. Necessary because some integrations (including KubeRay) instantiate the Monitor directly rather than running python Monitor.py with arguments.

Adds HTTP retries to Ray CR fetch. Necessary for robustness because Ray CR fetch exceptions are not currently handled during autoscaler initialization.
2022-06-25 11:56:25 -07:00
Kai Fricke
75d08b0632
[tune/structure] Refactor suggest into search package (#26074)
This PR renames the `suggest` package to `search` and alters the layout slightly.

In the new package, the higher-level abstractions are on the top level and the search algorithms have their own subdirectories.

In a future refactor, we can turn algorithms such as PBT into actual `SearchAlgorithm` classes and move them into the `search` package. 

The main reason to keep algorithms and searchers in the same directory is to avoid user confusion - for a user, `Bayesopt` is as much a search algorithm as e.g. `PBT`, so it doesn't make sense to split them up.
2022-06-25 14:55:30 +01:00
Eric Liang
7a29461c40
Add back ray.state in deprecation wrapper; print stack trace on warning (#26086) 2022-06-24 15:59:58 -07:00
clarng
f7d0ad3bb7
Enable isort for base directory (#26085)
Remove base dir : 'python/ray/*.py' from the isort blacklist. This is needed so it will run isort on subdirectories under python/ray, and allow us to start enabling isort for subdirectories
2022-06-24 15:32:51 -07:00
Amog Kamsetty
f71a4680da
[AIR] Add __init__.py to ray.air.callbacks (#26088) 2022-06-24 15:29:28 -07:00
Antoni Baum
0ec198acc2
[AIR] Remove unnecessary pandas from examples (#26009)
Removes unnecessary pandas usage from AIR examples. Helps ensure users do not follow bad practices.
2022-06-24 14:38:23 -07:00
Clark Zinzow
fcd583688a
[Datasets] [Hotfix] Update ds.to_pandas() limit error to reflect current limit API (#26081)
This PR is a hotfix updating the ds.to_pandas() limit error to reflect the current limit API in to_pandas().
2022-06-24 14:34:40 -07:00
shrekris-anyscale
97a9a20f74
[Serve] [Docs] Add Serve REST API Schema to Serve API Docs (#25786) 2022-06-24 14:06:26 -07:00
Kai Fricke
eee866d762
[tune/structure] Introduce logger package (#26049)
This PR splits up logger.py and moves it into its own subpackage. External imports don't have to be changed at all.
2022-06-24 08:46:24 +01:00
Chen Shen
ef00917df0
[CI] deflake test_multi_node_3 by increasing its timeout 2022-06-23 22:48:17 -07:00
Sebastián Ramírez
8bde3f5dd7
🎨 Update type annotations to include options in ray.remote() (#25999)
The current type annotations expect and support using:

```Python
@ray.remote
def do_things(x: int, y: float):
    return x * y
```

...without options.

This PR adds type annotations for passing options, as in:

```Python
@ray.remote(num_cpus=3)
def do_more_things(name: str, value: float):
    return f"{name}: {value}"
```

Before:

<img width="687" alt="Screenshot 2022-06-22 at 04 49 11" src="https://user-images.githubusercontent.com/1326112/174999689-80bdc3ce-b437-464f-b05c-7613b3f8f89b.png">

After (autocompletion):

<img width="687" alt="Screenshot 2022-06-22 at 04 50 34" src="https://user-images.githubusercontent.com/1326112/174999899-5062335a-17ee-44a8-ad5c-97335e201e7b.png">

...and no errors:

<img width="687" alt="Screenshot 2022-06-22 at 04 51 15" src="https://user-images.githubusercontent.com/1326112/175000001-0a978871-8835-426f-9e09-5848194639fd.png">
2022-06-23 17:50:25 -07:00
SangBin Cho
c2e003a47a
[Usage stats] Record Ray native library usage from a home temp folder (#25842)
This PR records the historical Ray native library usage to the home temp folder. Note that library usage only includes Ray native libraries (rllib, tune, dataset, workflow, and train). NOTE: The library usage is always recorded to /tmp/ray, but they will only recorded when the cluster that enables the usage stats is running. Note that this can generate quite big amount of false positive (e.g., If I import rllib once, and start cluster for local development, they will all considered as a rllib cluster).
2022-06-23 17:49:06 -07:00
Kai Fricke
b21314fac2
[tune/structure] Introduce trainable package (#26046)
Introduce a `trainable` package to house Trainable, FunctionTrainable (renamed), Session, and utilities.
2022-06-23 21:50:55 +01:00