Skip to content

Commit

Permalink
Skip tests for MLDataset when ray>=2.0 (#3319)
Browse files Browse the repository at this point in the history
Use latest ray

Temporarily pin numpy
  • Loading branch information
vcfgv committed Jan 13, 2023
1 parent bfa1409 commit 194021c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/platform-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ jobs:
rm -fr /tmp/etcd-$ETCD_VER-linux-amd64.tar.gz /tmp/etcd-download-test
fi
if [ -n "$WITH_RAY" ] || [ -n "$WITH_RAY_DAG" ] || [ -n "$WITH_RAY_DEPLOY" ]; then
pip install "xgboost_ray==0.1.5" "xgboost<1.6.0" "protobuf<4"
pip install "xgboost_ray" "protobuf<4"
# Future PR will Unpin numpy.
pip install "numpy<1.24"
# Use standard ray releases when ownership bug is fixed
pip uninstall -y ray
pip install https://s3-us-west-2.amazonaws.com/ray-wheels/master/c03d0432f3bb40f3c597b7fc450870ba5e34ad56/ray-3.0.0.dev0-cp38-cp38-manylinux2014_x86_64.whl
# pip uninstall -y ray
# pip install https://s3-us-west-2.amazonaws.com/ray-wheels/master/c03d0432f3bb40f3c597b7fc450870ba5e34ad56/ray-3.0.0.dev0-cp38-cp38-manylinux2014_x86_64.whl
# Ray Datasets need pyarrow>=6.0.1
pip install "pyarrow>=6.0.1"
fi
Expand Down
13 changes: 13 additions & 0 deletions mars/dataframe/contrib/raydataset/tests/test_mldataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .....deploy.oscar.session import new_session
from .....tests.core import require_ray
from .....utils import lazy_import
from ....utils import ray_deprecate_ml_dataset
from ....contrib import raydataset as mdd

ray = lazy_import("ray")
Expand Down Expand Up @@ -53,6 +54,10 @@ async def create_cluster(request):

@require_ray
@pytest.mark.asyncio
@pytest.mark.skipif(
ray_deprecate_ml_dataset in (True, None),
reason="Ray (>=2.0) has deprecated MLDataset.",
)
async def test_dataset_related_classes(ray_start_regular_shared):
from ..mldataset import ChunkRefBatch

Expand All @@ -74,6 +79,10 @@ async def test_dataset_related_classes(ray_start_regular_shared):
@require_ray
@pytest.mark.asyncio
@pytest.mark.parametrize("chunk_size_and_num_shards", [[5, 5], [5, 4], [None, None]])
@pytest.mark.skipif(
ray_deprecate_ml_dataset in (True, None),
reason="Ray (>=2.0) has deprecated MLDataset.",
)
async def test_convert_to_ray_mldataset(
ray_start_regular_shared, create_cluster, chunk_size_and_num_shards
):
Expand All @@ -92,6 +101,10 @@ async def test_convert_to_ray_mldataset(
@require_ray
@pytest.mark.asyncio
@pytest.mark.skipif(xgboost_ray is None, reason="xgboost_ray not installed")
@pytest.mark.skipif(
ray_deprecate_ml_dataset in (True, None),
reason="Ray (>=2.0) has deprecated MLDataset.",
)
async def test_mars_with_xgboost(ray_start_regular_shared, create_cluster):
from xgboost_ray import RayDMatrix, RayParams, train, predict
from sklearn.datasets import load_breast_cancer
Expand Down
5 changes: 5 additions & 0 deletions mars/dataframe/datasource/tests/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
read_ray_mldataset,
DataFrameReadMLDataset,
)
from ...utils import ray_deprecate_ml_dataset
from ..series import from_pandas as from_pandas_series


Expand Down Expand Up @@ -587,6 +588,10 @@ def test_date_range():


@require_ray
@pytest.mark.skipif(
ray_deprecate_ml_dataset in (True, None),
reason="Ray (>=2.0) has deprecated MLDataset.",
)
def test_read_ray_mldataset(ray_start_regular):
test_df1 = pd.DataFrame(
{
Expand Down
7 changes: 5 additions & 2 deletions mars/dataframe/datasource/tests/test_datasource_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
from ....config import option_context
from ....tests.core import require_cudf, require_ray
from ....utils import arrow_array_to_objects, lazy_import, pd_release_version
from ...utils import ray_deprecate_ml_dataset
from ..dataframe import from_pandas as from_pandas_df
from ..series import from_pandas as from_pandas_series
from ..index import from_pandas as from_pandas_index, from_tileable
from ..from_tensor import dataframe_from_tensor, dataframe_from_1d_tileables
from ..from_records import from_records


ray = lazy_import("ray")
_date_range_use_inclusive = pd_release_version[:2] >= (1, 4)

Expand Down Expand Up @@ -1214,7 +1214,10 @@ def test_read_raydataset(ray_start_regular, ray_create_mars_cluster):


@require_ray
@pytest.mark.skip_ray_dag # mldataset is not compatible with Ray DAG
@pytest.mark.skipif(
ray_deprecate_ml_dataset in (True, None),
reason="Ray (>=2.0) has deprecated MLDataset.",
)
def test_read_ray_mldataset(ray_start_regular, ray_create_mars_cluster):
test_dfs = [
pd.DataFrame(
Expand Down
9 changes: 9 additions & 0 deletions mars/dataframe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
is_full_slice,
parse_readable_size,
is_on_ray,
parse_version,
)

try:
Expand All @@ -53,6 +54,14 @@

cudf = lazy_import("cudf", rename="cudf")
vineyard = lazy_import("vineyard")
try:
import ray

ray_release_version = parse_version(ray.__version__).release
ray_deprecate_ml_dataset = ray_release_version[:2] >= (2, 0)
except ImportError:
ray_release_version = None
ray_deprecate_ml_dataset = None
logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 194021c

Please sign in to comment.