Skip to content

ExperimentRollbackController ​

python
ExperimentRollbackController(checkpoint_manager: CheckpointManager, monitor: AutoRollbackMonitor | None) -> None

Coordinates checkpoint tracking and checkpoint selection for automatic rollback.

Initialize the rollback controller.

Parameters:

  • checkpoint_manager (CheckpointManager) – Checkpoint manager used to load and move checkpoints.
  • monitor (AutoRollbackMonitor | None) – Optional automatic rollback monitor.

Source

Properties ​

last_checkpoint_number ​

python
last_checkpoint_number: int | None

Get the most recent checkpoint number seen by the controller.

Returns:

  • int | None – The latest checkpoint number, or None if no checkpoint is known.

Source

monitor ​

python
monitor: AutoRollbackMonitor | None

Get the configured automatic rollback monitor.

Returns:

  • AutoRollbackMonitor | None – The monitor, or None if automatic rollback is disabled.

Source

Methods ​

mark_restored_checkpoint ​

python
mark_restored_checkpoint(checkpoint_number: int | None) -> None

Record that the experiment resumed from an existing checkpoint.

Parameters:

  • checkpoint_number (int | None) – The restored checkpoint number.

Source

mark_rolled_back ​

python
mark_rolled_back(step: int) -> None

Notify the monitor that a rollback completed.

Parameters:

  • step (int) – The actor step at which the rollback happened.

Source

record_checkpoint ​

python
record_checkpoint(checkpoint_number: int, actor_step: int) -> None

Record a newly-saved checkpoint and the actor step at which it was written.

Parameters:

  • checkpoint_number (int) – The checkpoint number.
  • actor_step (int) – The actor step at the time of saving.

Source

record_metric ​

python
record_metric(step: int, value: float) -> None

Feed an observed metric value into the rollback monitor.

Parameters:

  • step (int) – The actor step.
  • value (float) – The observed metric value.

Source

should_rollback ​

python
should_rollback() -> bool

Check whether the configured rollback monitor requests a rollback.

Returns:

  • bool – True if a rollback should occur, else False.

Source

try_prepare_rollback ​

python
try_prepare_rollback(current_step: int) -> tuple[int, Checkpoint] | None

Select and load the rollback target checkpoint for the current step.

Parameters:

  • current_step (int) – The current actor step.

Returns:

  • tuple[int, Checkpoint] | None – (checkpoint_number, checkpoint) if a rollback target was found, else None.

Raises:

  • RuntimeError – If automatic rollback is not configured.

Source