rlightning.utils.placement.scheduling

Component Scheduling Configuration.

This module defines scheduling requirements for each component type and provides validation logic to ensure configurations are consistent and feasible.

class rlightning.utils.placement.scheduling.ComponentScheduling(env_worker: List[Scheduling] | None = None, train_worker: Scheduling | None = None, eval_worker: Scheduling | None = None, buffer_worker: Scheduling | None = None)[source]

Bases: object

Scheduling configuration for all components.

This class holds the resource requirements for each component type: - env_worker: Environment workers (can have multiple groups) - train_worker: Training policy workers - eval_worker: Evaluation policy workers (rollout) - buffer_worker: Data buffer storage workers

adjust_buffer_worker_num(train_node_count: int) None[source]

Adjust the buffer worker number to match the train worker number.

buffer_worker: Scheduling | None = None
env_worker: List[Scheduling] | None = None
eval_worker: Scheduling | None = None
get_component_requirements(component_type: str) Tuple[float, int][source]

Get resource requirements for all components.

Returns:

Tuple of (total_gpus, total_cpus) for the specified component type.

Raises:

ValueError – If component type is invalid or the worker is not configured.

infer_auto_buffer_worker_num(cluster_info: Dict[str, Any]) None[source]

Infer the auto buffer worker number based on the train worker number.

rollout_pool_requirements() Tuple[float, int][source]

Calculate resource requirements for rollout pool (eval + env).

Returns:

Tuple of (total_gpus, total_cpus).

summary() str[source]

Generate a human-readable summary.

to_dict() Dict[str, Any][source]

Convert to dictionary representation.

train_pool_requirements() Tuple[float, int][source]

Calculate resource requirements for train pool (train + buffer).

Returns:

Tuple of (total_gpus, total_cpus).

train_worker: Scheduling | None = None
class rlightning.utils.placement.scheduling.Scheduling(worker_num: int, num_cpus: int, num_gpus: float, node_list: str | None = None)[source]

Bases: object

Scheduling configuration for a single worker type.

worker_num

Number of workers of this type.

Type:

int

num_cpus

Number of CPUs per worker.

Type:

int

num_gpus

Number of GPUs per worker.

Type:

float

node_list

Optional comma-separated list of node IDs for placement.

Type:

str | None

node_list: str | None = None
num_cpus: int
num_gpus: float
to_dict() Dict[str, Any][source]

Convert to dictionary representation.

total_cpus() int[source]

Total CPU requirements for all workers of this type.

total_gpus() float[source]

Total GPU requirements for all workers of this type.

worker_num: int
rlightning.utils.placement.scheduling.setup_component_scheduling(cfg: MainConfig) ComponentScheduling[source]

Set up the scheduling configuration for all components from MainConfig.

This function: 1. Reads cluster configuration 2. Validates buffer storage configuration 3. Creates Scheduling objects for each component type

Parameters:

cfg – The main configuration object.

Returns:

ComponentScheduling with all component requirements.

Raises:

ValueError – If configuration is invalid.