Skip to content

EnvLifecycle ​

python
EnvLifecycle(env_factory: Callable[[], OakEmuMultiEnv]) -> None

Owns 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.

Source

Properties ​

env ​

python
env: OakEmuMultiEnv | None

Get the multi-environment instance, or None if not yet created.

Source

result_queue_depth ​

python
result_queue_depth: int

Get the current depth of the underlying environment result queue.

Returns:

  • int – The queue depth, or 0 if the environment has not started yet.

Source

Methods ​

create ​

python
create() -> OakEmuMultiEnv

Create the multi-environment via the factory and store it.

Returns:

  • OakEmuMultiEnv – The newly created multi-environment.

Source

require ​

python
require() -> OakEmuMultiEnv

Return the started multi-environment instance.

Returns:

  • OakEmuMultiEnv – The active OakEmu multi-environment.

Raises:

  • RuntimeError – If the environment has not been started yet.

Source

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.

Source