EnvLifecycle
python
EnvLifecycle(env_factory: Callable[[], OakEmuMultiEnv]) -> NoneOwns the multi-environment instance and its lazy-creation lifecycle for one agent-like runtime (actor, trainer, or tester).
Initialize the environment lifecycle.
Parameters:
env_factory(Callable[[], OakEmuMultiEnv]) – Factory used to build the multi-environment on demand.
Properties
env
python
env: OakEmuMultiEnv | NoneGet the multi-environment instance, or None if not yet created.
result_queue_depth
python
result_queue_depth: intGet the current depth of the underlying environment result queue.
Returns:
int– The queue depth, or 0 if the environment has not started yet.
Methods
create
python
create() -> OakEmuMultiEnvCreate the multi-environment via the factory and store it.
Returns:
OakEmuMultiEnv– The newly created multi-environment.
require
python
require() -> OakEmuMultiEnvReturn the started multi-environment instance.
Returns:
OakEmuMultiEnv– The active OakEmu multi-environment.
Raises:
RuntimeError– If the environment has not been started yet.
started
python
started() -> Generator[OakEmuMultiEnv]Create and start the multi-environment, yielding it and stopping it on exit.
Returns:
Generator[OakEmuMultiEnv]– A context manager yielding the started multi-environment.