rlightning.types.batched_data

Batched data container for environment and policy data.

This module provides the BatchedData class for holding collections of environment returns or policy responses, supporting both local data and Ray ObjectRefs for distributed execution.

class rlightning.types.batched_data.BatchedData(ids: List[Any], data: List[Any | MockModule('ray.ObjectRef')])[source]

Bases: object

Container for batched data with associated identifiers.

Holds either actual data or Ray ObjectRefs, maintaining the order of (id, data) pairs. Allows duplicate IDs.

is_future

True if any data element is a Ray ObjectRef.

static from_dict(data_dict: Dict) BatchedData[source]

Create BatchedData from a dictionary.

Parameters:

data_dict – Dictionary mapping IDs to data.

Returns:

BatchedData instance.

ids() Tuple[source]

Get all IDs in the batched data.

Returns:

Tuple of all identifiers.

items() Iterator[Tuple[Any, Any | MockModule('ray.ObjectRef')]][source]

Get (id, data) pairs iterator.

Returns:

Iterator of (id, data) pairs.

values() Tuple[source]

Get all data values.

Returns:

Tuple of all data elements.