Fix test_dying_worker_get (#5908)

This commit is contained in:
Eric Liang 2019-10-13 18:06:28 -07:00 committed by Simon Mo
parent 0f24509c30
commit 2cbc67f3d5

View file

@ -26,6 +26,7 @@ from ray.tests.utils import (run_string_as_driver_nonblocking,
def test_dying_worker_get(ray_start_2_cpus):
@ray.remote
def sleep_forever():
ray.experimental.signal.send("ready")
time.sleep(10**6)
@ray.remote
@ -33,7 +34,7 @@ def test_dying_worker_get(ray_start_2_cpus):
return os.getpid()
x_id = sleep_forever.remote()
time.sleep(0.01) # Try to wait for the sleep task to get scheduled.
ray.experimental.signal.receive([x_id]) # Block until it is scheduled.
# Get the PID of the other worker.
worker_pid = ray.get(get_worker_pid.remote())