RolloutHandshake
RolloutHandshake() -> NoneSynchronizes 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.
Methods
consume
consume() -> NoneLearner side: clear the ready signal and acknowledge consumption to the actor.
publish
publish() -> NoneActor side: mark a rollout ready, clearing any prior consumed acknowledgement.
release_for_shutdown
release_for_shutdown() -> NoneForce both signals set so any thread blocked in a wait can observe a stop request.
wait_consumed
wait_consumed(timeout: float | None = None) -> boolActor side: block until the learner acknowledges consuming the published rollout.
Parameters:
timeout(float | None) – Maximum time to wait in seconds, orNoneto wait indefinitely.
Returns:
bool–Trueif consumption was acknowledged before the timeout elapsed.
wait_published
wait_published(timeout: float | None = None) -> boolLearner side: block until a rollout is published.
Parameters:
timeout(float | None) – Maximum time to wait in seconds, orNoneto wait indefinitely.
Returns:
bool–Trueif a rollout was published before the timeout elapsed.