mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 02:46:49 +08:00
Fix asyncio plasma integration in cluster mode (#11665)
This commit is contained in:
@@ -91,6 +91,7 @@ py_test_module_list(
|
||||
files = [
|
||||
"test_args.py",
|
||||
"test_asyncio.py",
|
||||
"test_asyncio_cluster.py",
|
||||
"test_autoscaler.py",
|
||||
"test_autoscaler_yaml.py",
|
||||
"test_component_failures.py",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# coding: utf-8
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
import numpy as np
|
||||
|
||||
import ray
|
||||
from ray.cluster_utils import Cluster
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_asyncio_cluster_wait():
|
||||
cluster = Cluster()
|
||||
head_node = cluster.add_node()
|
||||
cluster.add_node(resources={"OTHER_NODE": 100})
|
||||
|
||||
ray.init(address=head_node.address)
|
||||
|
||||
@ray.remote(num_cpus=0, resources={"OTHER_NODE": 1})
|
||||
def get_array():
|
||||
return np.random.random((192, 1080, 3)).astype(np.uint8) # ~ 0.5MB
|
||||
|
||||
object_ref = get_array.remote()
|
||||
|
||||
await asyncio.wait_for(object_ref, timeout=10)
|
||||
|
||||
ray.shutdown()
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import pytest
|
||||
sys.exit(pytest.main(["-v", __file__]))
|
||||
Reference in New Issue
Block a user