mirror of
https://github.com/wassname/ray.git
synced 2026-07-14 11:17:54 +08:00
[ray_client]: Support runtime_context as metadata (#13428)
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import pytest
|
||||
|
||||
from ray.util.client.ray_client_helpers import ray_start_client_server
|
||||
from ray._raylet import NodeID
|
||||
|
||||
from ray.runtime_context import RuntimeContext
|
||||
|
||||
|
||||
def test_get_ray_metadata(ray_start_regular_shared):
|
||||
"""Test the ClusterInfo client data pathway and API surface
|
||||
"""
|
||||
"""Test the ClusterInfo client data pathway and API surface"""
|
||||
with ray_start_client_server() as ray:
|
||||
ip_address = ray_start_regular_shared["node_ip_address"]
|
||||
|
||||
@@ -22,3 +26,15 @@ def test_get_ray_metadata(ray_start_regular_shared):
|
||||
assert cluster_resources["CPU"] == 1.0
|
||||
assert current_node_id in cluster_resources
|
||||
assert current_node_id in available_resources
|
||||
|
||||
|
||||
def test_get_runtime_context(ray_start_regular_shared):
|
||||
"""Test the get_runtime_context data through the metadata API"""
|
||||
with ray_start_client_server() as ray:
|
||||
rtc = ray.get_runtime_context()
|
||||
assert isinstance(rtc, RuntimeContext)
|
||||
assert isinstance(rtc.node_id, NodeID)
|
||||
assert len(rtc.node_id.hex()) == 56
|
||||
|
||||
with pytest.raises(Exception):
|
||||
_ = rtc.task_id
|
||||
|
||||
Reference in New Issue
Block a user