Ignore blocking ray.wait if timeout is zero (#6891)

This commit is contained in:
Simon Mo
2020-01-22 16:05:34 -08:00
committed by GitHub
parent 6bb30c9f1b
commit 4dd41844d0
2 changed files with 9 additions and 3 deletions
+6
View File
@@ -254,10 +254,16 @@ def test_asyncio_actor_async_get(ray_start_regular_shared):
def remote_task():
return 1
plasma_object = ray.put(2)
@ray.remote
class AsyncGetter:
async def get(self):
return await remote_task.remote()
async def plasma_get(self):
return await plasma_object
getter = AsyncGetter.options(is_asyncio=True).remote()
assert ray.get(getter.get.remote()) == 1
assert ray.get(getter.plasma_get.remote()) == 2
+3 -3
View File
@@ -1573,9 +1573,9 @@ def wait(object_ids, num_returns=1, timeout=None):
"""
worker = global_worker
if hasattr(
worker,
"core_worker") and worker.core_worker.current_actor_is_asyncio():
if hasattr(worker,
"core_worker") and worker.core_worker.current_actor_is_asyncio(
) and timeout != 0:
raise RayError("Using blocking ray.wait inside async method. "
"This blocks the event loop. Please use `await` "
"on object id with asyncio.wait. ")