mirror of
https://github.com/wassname/ray.git
synced 2026-07-01 06:16:32 +08:00
[Placement Group] Support Placement Group state table. (#10090)
* Done. * Addressed code review. * Linting. * Fix lint. * Fix lint. * Fix a test. * Lint. * Add a lint sleep to test. * Fix the lint issue. * Fixed doc build error.
This commit is contained in:
@@ -7,6 +7,7 @@ from ray.includes.unique_ids cimport (
|
||||
CClientID,
|
||||
CObjectID,
|
||||
CWorkerID,
|
||||
CPlacementGroupID,
|
||||
)
|
||||
|
||||
cdef extern from "ray/gcs/gcs_client/global_state_accessor.h" nogil:
|
||||
@@ -27,3 +28,5 @@ cdef extern from "ray/gcs/gcs_client/global_state_accessor.h" nogil:
|
||||
unique_ptr[c_string] GetWorkerInfo(const CWorkerID &worker_id)
|
||||
c_vector[c_string] GetAllWorkerInfo()
|
||||
c_bool AddWorkerInfo(const c_string &serialized_string)
|
||||
unique_ptr[c_string] GetPlacementGroupInfo(
|
||||
const CPlacementGroupID &placement_group_id)
|
||||
|
||||
@@ -3,6 +3,7 @@ from ray.includes.unique_ids cimport (
|
||||
CClientID,
|
||||
CObjectID,
|
||||
CWorkerID,
|
||||
CPlacementGroupID
|
||||
)
|
||||
|
||||
from ray.includes.global_state_accessor cimport (
|
||||
@@ -114,3 +115,14 @@ cdef class GlobalStateAccessor:
|
||||
with nogil:
|
||||
result = self.inner.get().AddWorkerInfo(cserialized_string)
|
||||
return result
|
||||
|
||||
def get_placement_group_info(self, placement_group_id):
|
||||
cdef unique_ptr[c_string] result
|
||||
cdef CPlacementGroupID cplacement_group_id = (
|
||||
CPlacementGroupID.FromBinary(placement_group_id.binary()))
|
||||
with nogil:
|
||||
result = self.inner.get().GetPlacementGroupInfo(
|
||||
cplacement_group_id)
|
||||
if result:
|
||||
return c_string(result.get().data(), result.get().size())
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user