Skip to content

Commit

Permalink
[train] enable train + tune tests and examples (ray-project#39021)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: Jim Thompson <jimthompson5802@gmail.com>
  • Loading branch information
matthewdeng authored and jimthompson5802 committed Sep 12, 2023
1 parent e09cdf0 commit 4bd62dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
31 changes: 8 additions & 23 deletions .buildkite/pipeline.ml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,14 @@
--test_tag_filters=-gpu_only,-gpu,-minimal,-tune,-doctest
python/ray/train/...


# Currently empty test suite
#- label: ":steam_locomotive: :octopus: Train + Tune tests and examples"
# conditions: ["NO_WHEELS_REQUIRED", "RAY_CI_TRAIN_AFFECTED"]
# instance_size: medium
# commands:
# - cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
# - TRAIN_TESTING=1 TUNE_TESTING=1 ./ci/env/install-dependencies.sh
# - ./ci/env/env_info.sh
# - bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only --test_tag_filters=tune,-gpu_only,-ray_air,-gpu,-doctest,-new_storage python/ray/train/...
- label: ":steam_locomotive: :octopus: Train + Tune tests and examples"
conditions: ["NO_WHEELS_REQUIRED", "RAY_CI_TRAIN_AFFECTED"]
instance_size: medium
commands:
- cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
- TRAIN_TESTING=1 TUNE_TESTING=1 ./ci/env/install-dependencies.sh
- ./ci/env/env_info.sh
- bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only --test_tag_filters=tune,-gpu_only,-ray_air,-gpu,-doctest python/ray/train/...


- label: ":brain: RLlib: Benchmarks (Torch 2.x)"
Expand Down Expand Up @@ -361,19 +359,6 @@

##### STORAGE REFACTOR

# TODO(krfricke): Add new test for this suite
# - label: ":steam_locomotive: :octopus: :floppy_disk: New persistence mode: Train + Tune tests and examples"
# conditions: ["NO_WHEELS_REQUIRED", "RAY_CI_TRAIN_AFFECTED"]
# instance_size: medium
# commands:
# - cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
# - TRAIN_TESTING=1 TUNE_TESTING=1 ./ci/env/install-dependencies.sh
# - ./ci/env/env_info.sh
# - bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only
# --test_tag_filters=tune,-gpu_only,-ray_air,-gpu,-doctest,-no_new_storage
# --test_env=RAY_AIR_NEW_PERSISTENCE_MODE=1
# python/ray/train/...


- label: ":octopus: :floppy_disk: New persistence mode: Tune tests and examples (small)"
conditions: ["NO_WHEELS_REQUIRED", "RAY_CI_TUNE_AFFECTED"]
Expand Down
1 change: 1 addition & 0 deletions python/ray/train/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

usage_lib.record_library_usage("train")


__all__ = [
"get_checkpoint",
"get_context",
Expand Down
9 changes: 7 additions & 2 deletions python/ray/train/tests/test_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,20 @@ def train_func():
assert len(df[TRAINING_ITERATION]) == 4


def test_restore_with_new_trainer(ray_start_4_cpus, tmpdir, propagate_logs, caplog):
def test_restore_with_new_trainer(
ray_start_4_cpus, tmpdir, propagate_logs, caplog, monkeypatch
):

monkeypatch.setenv("RAY_AIR_LOCAL_CACHE_DIR", str(tmpdir))

def train_func(config):
raise RuntimeError("failing!")

trainer = DataParallelTrainer(
train_func,
backend_config=TestConfig(),
scaling_config=ScalingConfig(num_workers=1),
run_config=RunConfig(local_dir=str(tmpdir), name="restore_new_trainer"),
run_config=RunConfig(name="restore_new_trainer"),
datasets={"train": ray.data.from_items([{"a": i} for i in range(10)])},
)
results = Tuner(trainer).fit()
Expand Down

0 comments on commit 4bd62dc

Please sign in to comment.