Skip to content

Commit

Permalink
Added ray 1.13.0 and nightly wheel tests to CI (#2128)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaddair authored Jun 10, 2022
1 parent 2058a9b commit 6286815
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
- python-version: 3.8
pytorch-version: 1.11.0
torchscript-version: 1.10.2
ray-version: 1.12.0
ray-version: 1.13.0
- python-version: 3.9
pytorch-version: nightly
torchscript-version: 1.10.2
ray-version: 1.12.0
ray-version: nightly
env:
PYTORCH: ${{ matrix.pytorch-version }}
MARKERS: ${{ matrix.test-markers }}
Expand Down Expand Up @@ -102,7 +102,12 @@ jobs:
pip install protobuf==3.20.1 # https://github.com/databrickslabs/dbx/issues/257
if [ "$MARKERS" == "distributed" ]; then
pip install ray==$RAY_VERSION
if [ "$RAY_VERSION" == "nightly" ]; then
# NOTE: hardcoded for python 3.9 on Linux
pip install https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-manylinux2014_x86_64.whl
else
pip install ray==$RAY_VERSION
fi
ray_expected=$(python -c "import ray; print(ray.__version__)")
fi
Expand Down
2 changes: 1 addition & 1 deletion ludwig/backend/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from ludwig.utils.torch_utils import get_torch_device, initialize_pytorch
from ludwig.utils.types import Series

_ray112 = LooseVersion(ray.__version__) >= LooseVersion("1.12")
_ray112 = LooseVersion("1.12") <= LooseVersion(ray.__version__) < LooseVersion("1.13")
import ray.train as rt # noqa: E402
from ray.train.trainer import Trainer # noqa: E402

Expand Down
10 changes: 6 additions & 4 deletions ludwig/data/dataset/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from ludwig.utils.misc_utils import get_proc_features
from ludwig.utils.types import DataFrame

_ray112 = LooseVersion(ray.__version__) >= LooseVersion("1.12")
_ray113 = LooseVersion(ray.__version__) == LooseVersion("1.13.0")


_SCALAR_TYPES = {BINARY, CATEGORY, NUMBER}
Expand Down Expand Up @@ -83,10 +83,12 @@ def pipeline(
window_size_bytes: If not None, windowing is enabled and this parameter specifies the window size in bytes
for the dataset.
"""
if not fully_executed and not _ray112:
raise ValueError(f"Cannot set fully_execute=False in ray {ray.__version__}")
if fully_executed:
if _ray113:
# Workaround for: https://github.com/ray-project/ray/issues/25643
# TODO(travis): remove after 1.13.1
self.ds = self.ds.map_batches(lambda x: x, batch_size=None)

if fully_executed and _ray112:
# set instance state so calls to __len__ will also use the fully_executed version
self.ds = self.ds.fully_executed()

Expand Down
6 changes: 3 additions & 3 deletions ludwig/hyperopt/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
try:
from ray import tune
from ray.tune.schedulers.resource_changing_scheduler import (
evenly_distribute_cpus_gpus,
DistributeResources,
PlacementGroupFactory,
ResourceChangingScheduler,
)

_HAS_RAY_TUNE = True
except ImportError:
evenly_distribute_cpus_gpus = None
logging.exception("ImportError (sampling.py) failed to import ray tune")
_HAS_RAY_TUNE = False


Expand All @@ -41,7 +41,7 @@ def ray_resource_allocation_function(
scheduler: "ResourceChangingScheduler",
):
"""Determine resources to allocate to running trials."""
pgf = evenly_distribute_cpus_gpus(trial_runner, trial, result, scheduler)
pgf = DistributeResources(trial_runner, trial, result, scheduler)
# restore original base trial resources

# create bundles
Expand Down

0 comments on commit 6286815

Please sign in to comment.