ray.util.placement_group.PlacementGroup
ray.util.placement_group.PlacementGroup#
- class ray.util.placement_group.PlacementGroup(id: ray._raylet.PlacementGroupID, bundle_cache: Optional[List[Dict]] = None)[source]#
Bases:
object
A handle to a placement group.
PublicAPI: This API is stable across Ray releases.
- ready() ray._raylet.ObjectRef [source]#
Returns an ObjectRef to check ready status.
This API runs a small dummy task to wait for placement group creation. It is compatible to ray.get and ray.wait.
Example
>>> import ray >>> from ray.util.placement_group import PlacementGroup >>> pg = PlacementGroup([{"CPU": 1}]) >>> ray.get(pg.ready()) >>> pg = PlacementGroup([{"CPU": 1}]) >>> ray.wait([pg.ready()], timeout=0)
- wait(timeout_seconds: Union[float, int] = 30) bool [source]#
Wait for the placement group to be ready within the specified time. :param timeout_seconds: Timeout in seconds. :type timeout_seconds: float|int
- Returns
True if the placement group is created. False otherwise.
- property bundle_specs: List[Dict]#
Return bundles belonging to this placement group.
- Type
List[Dict]