From b7ebf17650a86192ac4b8cf33b8233ce8331f1db Mon Sep 17 00:00:00 2001 From: Stephanie Wang Date: Tue, 5 Mar 2019 18:37:00 -0800 Subject: [PATCH] Fix test (#4264) --- python/ray/tests/test_basic.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/ray/tests/test_basic.py b/python/ray/tests/test_basic.py index 4dfcb5210..8d91766ca 100644 --- a/python/ray/tests/test_basic.py +++ b/python/ray/tests/test_basic.py @@ -1158,10 +1158,17 @@ def test_wait_cluster(ray_start_cluster): def f(): return - # Submit some tasks that can only be executed on the remote nodes. + # Make sure we have enough workers on the remote nodes to execute some + # tasks. + tasks = [f.remote() for _ in range(10)] + start = time.time() + ray.get(tasks) + end = time.time() + + # Submit some more tasks that can only be executed on the remote nodes. tasks = [f.remote() for _ in range(10)] # Sleep for a bit to let the tasks finish. - time.sleep(1) + time.sleep((end - start) * 2) _, unready = ray.wait(tasks, num_returns=len(tasks), timeout=0) # All remote tasks should have finished. assert len(unready) == 0