rlightning.utils.placement.placement_strategies¶
Placement strategies for component scheduling.
This module provides different strategies for placing components on cluster resources: - DefaultPlacementStrategy: No specific placement, uses Ray’s default scheduling - ResourcePoolPlacementStrategy: Base class for resource pool-based placement - DisaggregatePlacementStrategy: Separate pools for Train+Buffer and Eval+Env - ColocatedPlacementStrategy: Shared pool for all components
- class rlightning.utils.placement.placement_strategies.ColocatedPlacementStrategy(scheduling: ComponentScheduling)[source]¶
Bases:
ResourcePoolPlacementStrategyColocated placement strategy.
All components share a global resource pool. Workers are distributed across nodes with consideration for resource utilization.
- create_placement_groups(resource_pools: Dict[str, Dict[str, Any]] | None = None, max_colocate_count: int = 10, **kwargs) Dict[str, MockModule('ray.util.placement_group.PlacementGroup')][source]¶
Create placement groups for colocated components.
- Parameters:
resource_pools – Dictionary with “global_pool” configuration.
max_colocate_count – Maximum number of components per node.
**kwargs – Additional strategy options kept for interface compatibility.
- class rlightning.utils.placement.placement_strategies.DefaultPlacementStrategy(scheduling: ComponentScheduling)[source]¶
Bases:
PlacementStrategyDefault placement strategy with no specific placement groups.
Uses node affinity for buffer workers when multiple are needed, but otherwise relies on Ray’s default scheduling.
- buffer_strategys¶
List of scheduling strategies for buffer workers.
- _node_info¶
Node information for resource-aware choices.
- create_placement_groups() Dict[str, MockModule('ray.util.placement_group.PlacementGroup')][source]¶
Create placement groups based on the strategy.
For multiple buffer storages, creates node affinity strategies to place each buffer on a different node.
- Returns:
Empty dictionary (no placement groups created).
- class rlightning.utils.placement.placement_strategies.DisaggregatePlacementStrategy(scheduling: ComponentScheduling)[source]¶
Bases:
ResourcePoolPlacementStrategyDisaggregate placement strategy.
Allocates separate resource pools for: - train_pool: Train workers + Buffer workers (colocated) - rollout_pool: Eval workers + Env workers (colocated)
This provides resource isolation between training and evaluation.
- create_placement_groups(resource_pools: Dict[str, Dict[str, Any]] | None = None, **kwargs) Dict[str, MockModule('ray.util.placement_group.PlacementGroup')][source]¶
Create placement groups based on resource pools.
- Parameters:
resource_pools – Dictionary with “train_pool” and “rollout_pool” configurations.
**kwargs – Additional strategy options kept for interface compatibility.
- class rlightning.utils.placement.placement_strategies.PlacementStrategy(scheduling: ComponentScheduling)[source]¶
Bases:
ABCAbstract base class for placement strategies.
Defines the interface for creating Ray placement groups and determining scheduling strategies for different component types.
- scheduling¶
Cluster scheduling configuration.
- placement_groups¶
Created placement groups by name.
- storage_to_train_workers¶
Mapping from storage index to train worker indices.
- abstractmethod create_placement_groups() Dict[str, MockModule('ray.util.placement_group.PlacementGroup')][source]¶
Create placement groups based on the strategy.
- Returns:
Dictionary mapping group names to PlacementGroup instances.
- abstractmethod get_scheduling_strategy(component_type: str, worker_index: int = 0) Any[source]¶
Get scheduling strategy for a specific component.
- Parameters:
component_type – Type of component (‘env’, ‘train’, ‘eval’, ‘buffer’).
worker_index – Index of the worker within its type.
- Returns:
Scheduling strategy (PlacementGroupSchedulingStrategy or ‘DEFAULT’).
- class rlightning.utils.placement.placement_strategies.ResourcePoolPlacementStrategy(scheduling: ComponentScheduling)[source]¶
Bases:
PlacementStrategyBase class for resource pool-based placement strategies.
Provides common functionality for creating placement groups from resource pools by reading component_types from pool config and scheduling info from self.scheduling.
- create_placement_groups(resource_pools: Dict[str, Dict[str, Any]] | None = None, **kwargs) Dict[str, MockModule('ray.util.placement_group.PlacementGroup')][source]¶
Create placement groups based on the strategy.