Code cleanup about python3 asyncio compat (#11134)

* cleanup python3 compat and others
This commit is contained in:
Siyuan (Ryans) Zhuang
2020-09-30 14:22:25 -07:00
committed by GitHub
parent 0dcfa9ed6c
commit f0dba6bd2b
6 changed files with 18 additions and 33 deletions
+5 -6
View File
@@ -119,14 +119,14 @@ async def test_asyncio_get(ray_start_regular_shared, event_loop):
def task():
return 1
assert await ray.async_compat.get_async(task.remote()) == 1
assert await task.remote().as_future() == 1
@ray.remote
def task_throws():
1 / 0
with pytest.raises(ray.exceptions.RayTaskError):
await ray.async_compat.get_async(task_throws.remote())
await task_throws.remote().as_future()
# Test actor calls.
str_len = 200 * 1024
@@ -145,15 +145,14 @@ async def test_asyncio_get(ray_start_regular_shared, event_loop):
actor = Actor.remote()
actor_call_future = ray.async_compat.get_async(actor.echo.remote(2))
actor_call_future = actor.echo.remote(2).as_future()
assert await actor_call_future == 2
promoted_to_plasma_future = ray.async_compat.get_async(
actor.big_object.remote())
promoted_to_plasma_future = actor.big_object.remote().as_future()
assert await promoted_to_plasma_future == "a" * str_len
with pytest.raises(ray.exceptions.RayTaskError):
await ray.async_compat.get_async(actor.throw_error.remote())
await actor.throw_error.remote().as_future()
def test_asyncio_actor_async_get(ray_start_regular_shared):