StepBreakpointer#

class StepBreakpointer(max_steps)[source]#

Bases: Breakpointer

Stops the pipeline after a fixed number of iterations.

This breakpointer terminates the iterative process once a specified maximum number of steps (iterations) has been completed. It maintains an internal counter that increments each time its check() method is called.

Parameters:

max_steps (int) – The maximum number of iterations to perform before stopping. Must be a positive integer.

Variables:
  • max_steps (int) – Stores the maximum number of steps.

  • _current_step (int) – The current iteration counter. It is reset to 0 after the limit is reached to allow the instance to be reused.

Raises:

ValueError – If max_steps is less than or equal to 0.

Methods

check(state)

Checks if the maximum number of iterations has been reached.