Add gcs object manager (#8298)

This commit is contained in:
fangfengbin
2020-05-25 17:21:35 +08:00
committed by GitHub
parent f22d12d2fc
commit 765d470c40
26 changed files with 768 additions and 564 deletions
@@ -1,6 +1,10 @@
from libcpp.string cimport string as c_string
from libcpp cimport bool as c_bool
from libcpp.vector cimport vector as c_vector
from libcpp.memory cimport unique_ptr
from ray.includes.unique_ids cimport (
CObjectID
)
cdef extern from "ray/gcs/gcs_client/global_state_accessor.h" nogil:
cdef cppclass CGlobalStateAccessor "ray::gcs::GlobalStateAccessor":
@@ -11,3 +15,5 @@ cdef extern from "ray/gcs/gcs_client/global_state_accessor.h" nogil:
void Disconnect()
c_vector[c_string] GetAllJobInfo()
c_vector[c_string] GetAllProfileInfo()
c_vector[c_string] GetAllObjectInfo()
unique_ptr[c_string] GetObjectInfo(const CObjectID &object_id)
@@ -1,7 +1,13 @@
from ray.includes.unique_ids cimport (
CObjectID
)
from ray.includes.global_state_accessor cimport (
CGlobalStateAccessor,
)
from libcpp.string cimport string as c_string
cdef class GlobalStateAccessor:
"""Cython wrapper class of C++ `ray::gcs::GlobalStateAccessor`."""
cdef:
@@ -25,3 +31,12 @@ cdef class GlobalStateAccessor:
def get_profile_table(self):
return self.inner.get().GetAllProfileInfo()
def get_object_table(self):
return self.inner.get().GetAllObjectInfo()
def get_object_info(self, object_id):
object_info = self.inner.get().GetObjectInfo(CObjectID.FromBinary(object_id.binary()))
if object_info:
return c_string(object_info.get().data(), object_info.get().size())
return None