Skip to content

RolloutHandshake ​

python
RolloutHandshake() -> None

Synchronizes rollout hand-off between the PPO actor and learner threads.

The actor collects a rollout, publishes it, and blocks until the learner has consumed it before starting the next one; the learner blocks (with a timeout, so it can still observe a stop request) until a rollout is published, then consumes it.

Initialize the handshake with both signals unset.

Source

Methods ​

consume ​

python
consume() -> None

Learner side: clear the ready signal and acknowledge consumption to the actor.

Source

publish ​

python
publish() -> None

Actor side: mark a rollout ready, clearing any prior consumed acknowledgement.

Source

release_for_shutdown ​

python
release_for_shutdown() -> None

Force both signals set so any thread blocked in a wait can observe a stop request.

Source

wait_consumed ​

python
wait_consumed(timeout: float | None = None) -> bool

Actor side: block until the learner acknowledges consuming the published rollout.

Parameters:

  • timeout (float | None) – Maximum time to wait in seconds, or None to wait indefinitely.

Returns:

  • bool – True if consumption was acknowledged before the timeout elapsed.

Source

wait_published ​

python
wait_published(timeout: float | None = None) -> bool

Learner side: block until a rollout is published.

Parameters:

  • timeout (float | None) – Maximum time to wait in seconds, or None to wait indefinitely.

Returns:

  • bool – True if a rollout was published before the timeout elapsed.

Source