mirror of
https://github.com/wassname/ray.git
synced 2026-07-04 05:35:55 +08:00
Code cleanup about python3 asyncio compat (#11134)
* cleanup python3 compat and others
This commit is contained in:
committed by
GitHub
parent
0dcfa9ed6c
commit
f0dba6bd2b
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user