pycram.failure_handling
Module Contents
Classes
Base class for failure handling mechanisms in automated systems or workflows. |
|
A subclass of FailureHandling that implements a retry mechanism. |
- class pycram.failure_handling.FailureHandling(designator_description: pycram.designator.DesignatorDescription)
Base class for failure handling mechanisms in automated systems or workflows.
This class provides a structure for implementing different strategies to handle failures that may occur during the execution of a plan or process. It is designed to be extended by subclasses that implement specific failure handling behaviors.
Initializes a new instance of the FailureHandling class.
- Parameters:
designator_description – The description or context of the task or process for which the failure handling is being set up.
- abstract perform()
Abstract method to perform the failure handling mechanism.
This method should be overridden in subclasses to implement the specific behavior for handling failures.
- Raises:
NotImplementedError – If the method is not implemented in a subclass.
- class pycram.failure_handling.Retry(designator_description: pycram.designator.DesignatorDescription, max_tries: int = 3)
Bases:
FailureHandling
A subclass of FailureHandling that implements a retry mechanism.
This class represents a specific failure handling strategy where the system attempts to retry a failed action a certain number of times before giving up.
- max_tries
The maximum number of attempts to retry the action.
- Type:
int
- Inherits:
All attributes and methods from the FailureHandling class.
- Overrides:
perform(): Implements the retry logic.
Initializes a new instance of the Retry class.
- Parameters:
designator_description – The description or context of the task or process for which the retry mechanism is being set up.
max_tries – The maximum number of attempts to retry. Defaults to 3.
- perform()
Implementation of the retry mechanism.
This method attempts to perform the action specified in the designator_description. If the action fails, it is retried up to max_tries times. If all attempts fail, the last exception is raised.
- Raises:
PlanFailure – If all retry attempts fail.