Exceptions
All the exceptions of the runner derive from RunnerBaseException. The
handler never lets them escape: it converts them into a FAILURE state in the
backend, a failed task in the response, or an entry in batchItemFailures
(see Concepts and behaviour).
- exception celery_cloud.exceptions.runner_base_exception.RunnerBaseException(message: str, detail: str | None = None)[source]
Bases:
ExceptionBase Domain exception for runner errors
- Parameters:
- exception celery_cloud.exceptions.runner_exceptions.BackendException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception for backend errors
- exception celery_cloud.exceptions.runner_exceptions.DuplicateTaskException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception: the task already exists in the backend.
SQS delivers messages at least once, so this is the expected way a duplicate delivery shows up. It must not be executed again.
- exception celery_cloud.exceptions.runner_exceptions.EventDecodeException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception for message decoding errors
- exception celery_cloud.exceptions.runner_exceptions.MessageDecodeException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception for message decoding errors
- exception celery_cloud.exceptions.runner_exceptions.ResultTooLargeException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception: the task result does not fit in a backend item.
Retrying cannot help, so it is stored as a task failure instead of being treated as a backend outage.
- exception celery_cloud.exceptions.runner_exceptions.RevokedTaskException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception: the task was revoked before it started.
- exception celery_cloud.exceptions.runner_exceptions.TaskDecodeException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception for task decoding errors
- exception celery_cloud.exceptions.runner_exceptions.TaskExecutionException(message: str, detail: str | None = None)[source]
Bases:
RunnerBaseExceptionDomain exception for execution exceptions
Exceptions for task code
Raised or used inside tasks (from celery_cloud import ...). The client receives the
Celery classes of the same name.
Exceptions raised inside task code by the runner itself.
They are plain Exception subclasses (not RunnerBaseException) because
user code can catch them, exactly as with Celery’s own classes of the same name.
celery_module tells the runner which module to report in a FAILURE result:
the Celery client rebuilds the exception from exc_module + exc_type, so
reporting celery.exceptions makes except celery.exceptions.SoftTimeLimitExceeded
work on the client.
- exception celery_cloud.exceptions.task_exceptions.Ignore[source]
Bases:
ExceptionRaised by a task to end without storing any result (the state is left as is).
Typical use: update the state yourself with
update_stateand thenraise Ignore().- celery_module = 'celery.exceptions'
- exception celery_cloud.exceptions.task_exceptions.MaxRetriesExceededError[source]
Bases:
Exceptionretry()was called more times thanmax_retriesallows.- celery_module = 'celery.exceptions'
- exception celery_cloud.exceptions.task_exceptions.Reject(reason: str | None = None, requeue: bool = False)[source]
Bases:
ExceptionRaised by a task to reject its message.
- Parameters:
reason – Why it was rejected.
requeue – When True the message goes back to SQS and the task runs again. When False the task is stored as
REJECTEDand dropped.
- celery_module = 'celery.exceptions'
- exception celery_cloud.exceptions.task_exceptions.Retry(exc: BaseException | None = None, countdown: float | None = None, eta: datetime | None = None, message: str | None = None)[source]
Bases:
ExceptionRaised by
retry(): the runner re-sends the task instead of failing it.- Parameters:
exc – The exception that caused the retry (reported if retries run out).
countdown – Seconds to wait before the next attempt.
eta – Absolute time (
datetime) of the next attempt; wins overcountdown.
- __init__(exc: BaseException | None = None, countdown: float | None = None, eta: datetime | None = None, message: str | None = None) None[source]
- celery_module = 'celery.exceptions'