Skip to content

Commit

Permalink
Make test_session_set_progress more stable under Ray tests (mars-pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongchun authored and wjsi committed Jun 1, 2022
1 parent 99ae0f7 commit 43a87a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mars/deploy/oscar/tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,15 @@ async def test_session_get_progress(create_cluster):
assert session.session_id is not None

raw = np.random.rand(100, 4)
t = mt.tensor(raw, chunk_size=5)
t = mt.tensor(raw, chunk_size=50)

def f1(c):
time.sleep(0.5)
return c

t1 = t.sum()
r = t1.map_chunk(f1)
t2 = t1.map_chunk(f1)
r = t2.map_chunk(f1)
info = await session.execute(r)

for _ in range(100):
Expand Down
7 changes: 7 additions & 0 deletions mars/deploy/oscar/tests/test_ray_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@
@pytest.mark.parametrize(indirect=True)
@pytest.fixture
async def create_cluster(request):
param = getattr(request, "param", {})
start_method = os.environ.get("POOL_START_METHOD", None)
client = await new_cluster(
subprocess_start_method=start_method,
backend="ray",
n_worker=2,
n_cpu=2,
use_uvloop=False,
config=param.get("config", None),
)
async with client:
assert client.session.client is not None
Expand Down Expand Up @@ -119,6 +121,11 @@ def test_sync_execute(config):


@require_ray
@pytest.mark.parametrize(
"create_cluster",
[{"config": {"task.execution_config.ray.subtask_monitor_interval": 0}}],
indirect=True,
)
@pytest.mark.asyncio
async def test_session_get_progress(ray_start_regular_shared2, create_cluster):
await test_local.test_session_get_progress(create_cluster)

0 comments on commit 43a87a4

Please sign in to comment.