Skip to content

Commit 8aefc09

Browse files
author
Xuye (Chris) Qin
authored
[BACKPORT][Ray] Fix flaky test test_optional_supervisor_node (#3133) (#3135)
1 parent c086c0f commit 8aefc09

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

mars/deploy/oscar/tests/test_ray.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -187,38 +187,6 @@ def _sync_web_session_test(web_address):
187187
return True
188188

189189

190-
@require_ray
191-
@pytest.mark.parametrize(
192-
"test_option",
193-
[
194-
[True, 0, ["ray://test_cluster/1/0", "ray://test_cluster/2/0"]],
195-
[False, 0, ["ray://test_cluster/0/1", "ray://test_cluster/1/0"]],
196-
[True, 2, ["ray://test_cluster/1/0", "ray://test_cluster/2/0"]],
197-
[False, 5, ["ray://test_cluster/0/6", "ray://test_cluster/1/0"]],
198-
],
199-
)
200-
@pytest.mark.asyncio
201-
async def test_optional_supervisor_node(ray_start_regular_shared, test_option):
202-
import logging
203-
204-
logging.basicConfig(level=logging.INFO)
205-
supervisor_standalone, supervisor_sub_pool_num, worker_addresses = test_option
206-
config = _load_config()
207-
config["cluster"]["ray"]["supervisor"]["standalone"] = supervisor_standalone
208-
config["cluster"]["ray"]["supervisor"]["sub_pool_num"] = supervisor_sub_pool_num
209-
client = await new_cluster(
210-
"test_cluster",
211-
supervisor_mem=1 * 1024**3,
212-
worker_num=2,
213-
worker_cpu=2,
214-
worker_mem=1 * 1024**3,
215-
config=config,
216-
)
217-
async with client:
218-
assert client.address == "ray://test_cluster/0/0"
219-
assert client._cluster._worker_addresses == worker_addresses
220-
221-
222190
@require_ray
223191
@pytest.mark.parametrize(
224192
"config",

mars/deploy/oscar/tests/test_ray_cluster_standalone.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import pytest
1516
import mars
17+
1618
from .... import tensor as mt
1719
from .... import dataframe as md
1820
from ....tests.core import require_ray
1921
from ....utils import lazy_import
2022
from ..ray import (
2123
new_cluster_in_ray,
2224
new_ray_session,
25+
_load_config,
26+
new_cluster,
2327
)
2428

2529
ray = lazy_import("ray")
@@ -64,3 +68,35 @@ def new_ray_session_test():
6468

6569
gc.collect()
6670
mars.execute(mt.random.RandomState(0).rand(100, 5).sum())
71+
72+
73+
@require_ray
74+
@pytest.mark.parametrize(
75+
"test_option",
76+
[
77+
[True, 0, ["ray://test_cluster/1/0", "ray://test_cluster/2/0"]],
78+
[False, 0, ["ray://test_cluster/0/1", "ray://test_cluster/1/0"]],
79+
[True, 2, ["ray://test_cluster/1/0", "ray://test_cluster/2/0"]],
80+
[False, 5, ["ray://test_cluster/0/6", "ray://test_cluster/1/0"]],
81+
],
82+
)
83+
@pytest.mark.asyncio
84+
async def test_optional_supervisor_node(ray_start_regular, test_option):
85+
import logging
86+
87+
logging.basicConfig(level=logging.INFO)
88+
supervisor_standalone, supervisor_sub_pool_num, worker_addresses = test_option
89+
config = _load_config()
90+
config["cluster"]["ray"]["supervisor"]["standalone"] = supervisor_standalone
91+
config["cluster"]["ray"]["supervisor"]["sub_pool_num"] = supervisor_sub_pool_num
92+
client = await new_cluster(
93+
"test_cluster",
94+
supervisor_mem=1 * 1024**3,
95+
worker_num=2,
96+
worker_cpu=2,
97+
worker_mem=1 * 1024**3,
98+
config=config,
99+
)
100+
async with client:
101+
assert client.address == "ray://test_cluster/0/0"
102+
assert client._cluster._worker_addresses == worker_addresses

0 commit comments

Comments
 (0)