Backend: Base - celery.backends.base

celery.backends.base

class celery.backends.base.BaseBackend

The base backend class. All backends should inherit from this.

cleanup()
Backend cleanup. Is run by celery.task.DeleteExpiredTaskMetaTask.
get_result(task_id)
Get the result of a task.
get_status(task_id)
Get the status of a task.
is_done(task_id)
Returns True if the task was successfully executed.
mark_as_done(task_id, result)
Mark task as successfully executed.
mark_as_failure(task_id, exc)
Mark task as executed with failure. Stores the execption.
mark_as_retry(task_id, exc)
Mark task for retry.
prepare_result(result)
Prepare result for storage.
store_result(task_id, result, status)
Store the result and status of a task.
wait_for(task_id, timeout=None)

Wait for task and return its result.

If the task raises an exception, this exception will be re-raised by wait_for().

If timeout is not None, this raises the celery.timer.TimeoutError exception if the operation takes longer than timeout seconds.

exception celery.backends.base.UnpickleableExceptionWrapper(exc_module, exc_cls_name, exc_args)

Wraps unpickleable exceptions.

Parameters:
  • exc_module – see exc_module.
  • exc_cls_name – see exc_cls_name.
  • exc_args – The arguments for the original exception.
exc_module
The module of the original exception.
exc_cls_name
The name of the original exception class.

Example

>>> try:
...     something_raising_unpickleable_exc()
>>> except Exception, e:
...     exc = UnpickleableException(e.__class__.__module__,
...                                 e.__class__.__name__,
...                                 e.args)
...     pickle.dumps(exc) # Works fine.
celery.backends.base.find_nearest_pickleable_exception(exc)

With an exception instance, iterate over its super classes (by mro) and find the first super exception that is pickleable.

Parameter:exc – An exception instance.
Return type:Exception

Previous topic

Backends - celery.backends

Next topic

Backend: Database - celery.backends.database

This Page