mirror of
https://github.com/wassname/ray.git
synced 2026-07-10 19:28:26 +08:00
[Placement Group]Add get all placement group api (#11460)
* add get all interface for placement group * add get all interface for placement group * make it work * fix lint * fix lint * fix comment * add cpp test * fix python lint
This commit is contained in:
+12
-2
@@ -388,8 +388,18 @@ class GlobalState:
|
||||
FromString(placement_group_info))
|
||||
return self._gen_placement_group_info(placement_group_info)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"Get all placement group is not implemented yet.")
|
||||
placement_group_table = self.global_state_accessor.\
|
||||
get_placement_group_table()
|
||||
results = {}
|
||||
for placement_group_info in placement_group_table:
|
||||
placement_group_table_data = gcs_utils.\
|
||||
PlacementGroupTableData.FromString(placement_group_info)
|
||||
placement_group_id = binary_to_hex(
|
||||
placement_group_table_data.placement_group_id)
|
||||
results[placement_group_id] = \
|
||||
self._gen_placement_group_info(placement_group_table_data)
|
||||
|
||||
return results
|
||||
|
||||
def _gen_placement_group_info(self, placement_group_info):
|
||||
# This should be imported here, otherwise, it will error doc build.
|
||||
|
||||
Reference in New Issue
Block a user