Module rabotnik.exceptions

Classes

class EnvironmentVariableNotSet (variable_name: str)

Raise this exception when an environment variable is undefined which is required.

Expand source code
class EnvironmentVariableNotSet(Exception):
    """Raise this exception when an environment variable is undefined which is required."""

    def __init__(self, variable_name: str):
        self.variable_name = variable_name

    def __str__(self):
        return "environment variable undefined which is required: %s" % self.variable_name

Ancestors

  • builtins.Exception
  • builtins.BaseException
class ErrorHandler

Abstract base class (ABC) that handles errors of Rabotnik tasks.

Expand source code
class ErrorHandler(Task, ABC):
    """
    Abstract base class (`ABC`) that handles errors of Rabotnik tasks.
    """

    def on_failure(self, exc, task_id, args, kwargs, einfo):
        """
        Logs the task ID and the error when the task fails.

        Args:
            exc (Exception):
                The exception raised by the task.
            task_id (str):
                Unique id of the failed task.
            args (Tuple):
                Original arguments for the task that failed.
            kwargs (Dict):
                Original keyword arguments for the task that failed.
            einfo (~billiard.einfo.ExceptionInfo):
                Exception information.
        """

        logger.warning(f"{task_id} failed: {exc}")

Ancestors

  • celery.app.task.Task
  • abc.ABC

Subclasses

Methods

def on_failure(self, exc, task_id, args, kwargs, einfo)

Logs the task ID and the error when the task fails.

Args

exc (Exception): The exception raised by the task. task_id (str): Unique id of the failed task. args (Tuple): Original arguments for the task that failed. kwargs (Dict): Original keyword arguments for the task that failed. einfo (~billiard.einfo.ExceptionInfo): Exception information.