mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[flakey] Fix test_modin.py (#25469)
test_modin.py is flakey right now. It complains about some modules can't be imported. This seems like a init issue where client mode and non-client mode are mixed. This test closes the cluster for each run. It slows the test a little bit, but it's more stable.
This commit is contained in:
parent
c5f4a82e3c
commit
47c4f6f094
2 changed files with 6 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
||||||
py_test(
|
py_test(
|
||||||
name = "test_modin",
|
name = "test_modin",
|
||||||
size = "small",
|
size = "large",
|
||||||
srcs = ["test_modin.py"],
|
srcs = ["test_modin.py"],
|
||||||
deps = ["//:ray_lib"],
|
deps = ["//:ray_lib"],
|
||||||
tags = ["team:core", "exclusive"],
|
tags = ["team:core", "exclusive"],
|
||||||
|
|
|
@ -22,7 +22,7 @@ import pandas
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.testing import assert_array_equal
|
from numpy.testing import assert_array_equal
|
||||||
import ray
|
import ray
|
||||||
from ray.util.client.ray_client_helpers import ray_start_client_server
|
from ray.tests.conftest import start_cluster # noqa F401
|
||||||
|
|
||||||
modin_compatible_version = sys.version_info >= (3, 7, 0)
|
modin_compatible_version = sys.version_info >= (3, 7, 0)
|
||||||
modin_installed = True
|
modin_installed = True
|
||||||
|
@ -45,16 +45,10 @@ if not skip:
|
||||||
|
|
||||||
# Module scoped fixture. Will first run all tests without ray
|
# Module scoped fixture. Will first run all tests without ray
|
||||||
# client, then rerun all tests with a single ray client session.
|
# client, then rerun all tests with a single ray client session.
|
||||||
@pytest.fixture(params=[False, True], autouse=True, scope="module")
|
@pytest.fixture(autouse=True)
|
||||||
def run_ray_client(request):
|
def run_ray_client(start_cluster): # noqa F811
|
||||||
if request.param:
|
ray.init(start_cluster[1])
|
||||||
with ray_start_client_server() as client:
|
yield
|
||||||
yield client
|
|
||||||
else:
|
|
||||||
# Run without ray client (do nothing)
|
|
||||||
yield
|
|
||||||
# Cleanup state before rerunning tests with client
|
|
||||||
ray.shutdown()
|
|
||||||
|
|
||||||
|
|
||||||
random_state = np.random.RandomState(seed=42)
|
random_state = np.random.RandomState(seed=42)
|
||||||
|
|
Loading…
Add table
Reference in a new issue