mirror of
https://github.com/wassname/ray.git
synced 2026-07-06 05:16:30 +08:00
@@ -8,6 +8,12 @@ if TYPE_CHECKING:
|
||||
from ray.util.client.common import ClientObjectRef
|
||||
|
||||
|
||||
def as_bytes(value):
|
||||
if isinstance(value, str):
|
||||
return value.encode("utf-8")
|
||||
return value
|
||||
|
||||
|
||||
class ClientAPI:
|
||||
"""The Client-side methods corresponding to the ray API. Delegates
|
||||
to the Client Worker that contains the connection to the ClientServer.
|
||||
@@ -226,6 +232,26 @@ class ClientAPI:
|
||||
return self.worker.get_cluster_info(
|
||||
ray_client_pb2.ClusterInfoType.AVAILABLE_RESOURCES)
|
||||
|
||||
def _internal_kv_initialized(self) -> bool:
|
||||
"""Hook for internal_kv._internal_kv_initialized."""
|
||||
return self.is_initialized()
|
||||
|
||||
def _internal_kv_get(self, key: bytes) -> bytes:
|
||||
"""Hook for internal_kv._internal_kv_get."""
|
||||
return self.worker.internal_kv_get(as_bytes(key))
|
||||
|
||||
def _internal_kv_put(self, key: bytes, value: bytes) -> bool:
|
||||
"""Hook for internal_kv._internal_kv_put."""
|
||||
return self.worker.internal_kv_put(as_bytes(key), as_bytes(value))
|
||||
|
||||
def _internal_kv_del(self, key: bytes) -> None:
|
||||
"""Hook for internal_kv._internal_kv_del."""
|
||||
return self.worker.internal_kv_del(as_bytes(key))
|
||||
|
||||
def _internal_kv_list(self, prefix: bytes) -> bytes:
|
||||
"""Hook for internal_kv._internal_kv_list."""
|
||||
return self.worker.internal_kv_list(as_bytes(prefix))
|
||||
|
||||
def __getattr__(self, key: str):
|
||||
if not key.startswith("_"):
|
||||
raise NotImplementedError(
|
||||
|
||||
Reference in New Issue
Block a user