Skip to main content

prefect.retries.stop_conditions

Classes

StopCondition

A protocol that defines a stopping condition for an attempting generator. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.

NoException

A StopCondition implementation that stops if no exception is raised in the attempt context. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.

ExceptionMatches

A StopCondition implementation that stops if the exception matches the given type. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.

AttemptsExhausted

A StopCondition implementation that stops after a fixed number of attempts. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.

IntersectionStopCondition

A StopCondition implementation that stops if all of the given StopCondition instances are met. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.

UnionStopCondition

A StopCondition implementation that stops if any of the given StopCondition instances are met. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.

InvertedStopCondition

A StopCondition implementation that inverts the given StopCondition. Methods:

is_met

is_met(self, context: AttemptState | None) -> bool

is_met

is_met(self, context: AttemptState | None) -> bool
Checks if execution should stop. Args:
  • context: The current attempt context.
Returns:
  • True if the stopping condition is met, False otherwise.
I