ray.util.placement_group(bundles: List[Dict[str, float]], strategy: str = 'PACK', name: str = '', lifetime: Optional[str] = None, _max_cpu_fraction_per_node: float = 1.0) ray.util.placement_group.PlacementGroup[source]#

Asynchronously creates a PlacementGroup.

  • bundles – A list of bundles which represent the resources requirements.

  • strategy

    The strategy to create the placement group.

    • ”PACK”: Packs Bundles into as few nodes as possible.

    • ”SPREAD”: Places Bundles across distinct nodes as even as possible.

    • ”STRICT_PACK”: Packs Bundles into one node. The group is not allowed to span multiple nodes.

    • ”STRICT_SPREAD”: Packs Bundles across distinct nodes.

  • name – The name of the placement group.

  • lifetime – Either None, which defaults to the placement group will fate share with its creator and will be deleted once its creator is dead, or “detached”, which means the placement group will live as a global object independent of the creator.

  • _max_cpu_fraction_per_node – (Experimental) Disallow placing bundles on nodes if it would cause the fraction of CPUs used by bundles from any placement group on the node to exceed this fraction. This effectively sets aside CPUs that placement groups cannot occupy on nodes. when max_cpu_fraction_per_node < 1.0, at least 1 CPU will be excluded from placement group scheduling. Note: This feature is experimental and is not recommended for use with autoscaling clusters (scale-up will not trigger properly).

  • ValueError if bundle type is not a list.

  • ValueError if empty bundle or empty resource bundles are given.

  • ValueError if the wrong lifetime arguments are given.


Placement group object.

Return type