Add C++ global state for actor table (#8501)

* add global state actors

* fix code style

* fix GcsActorManagerTest bug

* rebase master

* add jni code

* add get checkpoint id code

* add debug code

* add debug code

* change log level

* fix compile bug

* return null in jni

* fix crash bug

* change import seq

Co-authored-by: 灵洵 <fengbin.ffb@antfin.com>
Co-authored-by: Hao Chen <chenh1024@gmail.com>
This commit is contained in:
fangfengbin
2020-05-29 21:10:42 +08:00
committed by GitHub
parent d483ed28ba
commit 35eeec5647
21 changed files with 393 additions and 244 deletions
@@ -3,7 +3,8 @@ 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
CActorID,
CObjectID,
)
cdef extern from "ray/gcs/gcs_client/global_state_accessor.h" nogil:
@@ -18,3 +19,5 @@ cdef extern from "ray/gcs/gcs_client/global_state_accessor.h" nogil:
c_vector[c_string] GetAllProfileInfo()
c_vector[c_string] GetAllObjectInfo()
unique_ptr[c_string] GetObjectInfo(const CObjectID &object_id)
c_vector[c_string] GetAllActorInfo()
unique_ptr[c_string] GetActorInfo(const CActorID &actor_id)
+11 -1
View File
@@ -1,5 +1,6 @@
from ray.includes.unique_ids cimport (
CObjectID
CActorID,
CObjectID,
)
from ray.includes.global_state_accessor cimport (
@@ -43,3 +44,12 @@ cdef class GlobalStateAccessor:
if object_info:
return c_string(object_info.get().data(), object_info.get().size())
return None
def get_actor_table(self):
return self.inner.get().GetAllActorInfo()
def get_actor_info(self, actor_id):
actor_info = self.inner.get().GetActorInfo(CActorID.FromBinary(actor_id.binary()))
if actor_info:
return c_string(actor_info.get().data(), actor_info.get().size())
return None