From ec6dd336b9ff541eb7f89d96333c3be114ef8523 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Mon, 6 Mar 2023 22:55:56 -0800 Subject: [PATCH 1/2] restore Signed-off-by: Eric Liang --- python/ray/data/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/ray/data/__init__.py b/python/ray/data/__init__.py index 9a114f84490a..f4894f0a3d98 100644 --- a/python/ray/data/__init__.py +++ b/python/ray/data/__init__.py @@ -1,3 +1,11 @@ +import sys + +# Short term workaround for https://github.com/ray-project/ray/issues/32435 +# Datasets currently has a hard dependency on pandas, so it doesn't need to be delayed. +# ray.data import is still eager for all ray imports for Python 3.6: +if sys.version_info >= (3, 7): + import pandas # noqa + from ray.data._internal.compute import ActorPoolStrategy from ray.data._internal.progress_bar import set_progress_bars from ray.data.dataset import Dataset From 49183cc211ae0735d63098cd844bb51105e0ac48 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Tue, 7 Mar 2023 11:40:43 -0800 Subject: [PATCH 2/2] use wait for condition Signed-off-by: Eric Liang --- python/ray/data/tests/test_dataset_image.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/python/ray/data/tests/test_dataset_image.py b/python/ray/data/tests/test_dataset_image.py index b22fa3b37847..200aaef1adea 100644 --- a/python/ray/data/tests/test_dataset_image.py +++ b/python/ray/data/tests/test_dataset_image.py @@ -1,5 +1,4 @@ import os -import time from typing import Dict import numpy as np @@ -18,6 +17,7 @@ from ray.data.tests.conftest import * # noqa from ray.data.tests.mock_http_server import * # noqa from ray.tests.conftest import * # noqa +from ray._private.test_utils import wait_for_condition class TestReadImages: @@ -193,12 +193,7 @@ def test_dynamic_block_split(ray_start_regular_shared): ds.fully_executed() # Verify dynamic block splitting taking effect to generate more blocks. assert ds.num_blocks() == 3 - - # NOTE: Need to wait for 1 second before checking stats, because we report - # stats to stats actors asynchronously when returning the blocks metadata. - # TODO(chengsu): clean it up after refactoring lazy block list. - time.sleep(1) - assert "3 blocks executed" in ds.stats() + wait_for_condition(lambda: "3 blocks executed" in ds.stats(), timeout=20) # Test union of same datasets union_ds = ds.union(ds, ds, ds).fully_executed()