This document describes an older version of Celery (2.5). For the latest stable version please go here.

celery.backends.base

celery.backends.base

class celery.backends.base.BaseBackend(*args, **kwargs)

Base backend class.

EXCEPTION_STATES = frozenset(['FAILURE', 'RETRY', 'REVOKED'])
READY_STATES = frozenset(['FAILURE', 'REVOKED', 'SUCCESS'])
exception TimeoutError

The operation timed out.

BaseBackend.UNREADY_STATES = frozenset(['STARTED', 'RECEIVED', 'RETRY', 'PENDING'])
BaseBackend.cleanup()

Backend cleanup. Is run by celery.task.DeleteExpiredTaskMetaTask.

BaseBackend.decode(payload)
BaseBackend.delete_taskset(taskset_id)
BaseBackend.encode(data)
BaseBackend.encode_result(result, status)
BaseBackend.exception_to_python(exc)

Convert serialized exception to Python exception.

BaseBackend.forget(task_id)
BaseBackend.get_result(task_id)

Get the result of a task.

BaseBackend.get_status(task_id)

Get the status of a task.

BaseBackend.get_traceback(task_id)

Get the traceback for a failed task.

BaseBackend.mark_as_done(task_id, result)

Mark task as successfully executed.

BaseBackend.mark_as_failure(task_id, exc, traceback=None)

Mark task as executed with failure. Stores the execption.

BaseBackend.mark_as_retry(task_id, exc, traceback=None)

Mark task as being retries. Stores the current exception (if any).

BaseBackend.mark_as_revoked(task_id)
BaseBackend.mark_as_started(task_id, **meta)

Mark a task as started

BaseBackend.on_chord_apply(setid, body, result=None, **kwargs)
BaseBackend.on_chord_part_return(task, propagate=False)
BaseBackend.prepare_exception(exc)

Prepare exception for serialization.

BaseBackend.prepare_expires(value, type=None)
BaseBackend.prepare_value(result)

Prepare value for storage.

BaseBackend.process_cleanup()

Cleanup actions to do at the end of a task worker process.

BaseBackend.reload_task_result(task_id)

Reload task result, even if it has been previously fetched.

BaseBackend.reload_taskset_result(task_id)

Reload taskset result, even if it has been previously fetched.

BaseBackend.restore_taskset(taskset_id, cache=True)

Get the result of a taskset.

BaseBackend.save_taskset(taskset_id, result)

Store the result and status of a task.

BaseBackend.store_result(task_id, result, status, traceback=None)

Store the result and status of a task.

BaseBackend.subpolling_interval = None

Time to sleep between polling each individual item in ResultSet.iterate. as opposed to the interval argument which is for each pass.

BaseBackend.supports_native_join = False

If true the backend must implement get_many().

BaseBackend.wait_for(task_id, timeout=None, propagate=True, interval=0.5)

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.exceptions.TimeoutError exception if the operation takes longer than timeout seconds.

class celery.backends.base.BaseDictBackend(*args, **kwargs)
delete_taskset(taskset_id)
forget(task_id)
get_result(task_id)

Get the result of a task.

get_status(task_id)

Get the status of a task.

get_task_meta(task_id, cache=True)
get_taskset_meta(taskset_id, cache=True)
get_traceback(task_id)

Get the traceback for a failed task.

reload_task_result(task_id)
reload_taskset_result(taskset_id)
restore_taskset(taskset_id, cache=True)

Get the result for a taskset.

save_taskset(taskset_id, result)

Store the result of an executed taskset.

store_result(task_id, result, status, traceback=None, **kwargs)

Store task result and status.

class celery.backends.base.DisabledBackend(*args, **kwargs)
get_result(*args, **kwargs)
get_status(*args, **kwargs)
get_traceback(*args, **kwargs)
store_result(*args, **kwargs)
wait_for(*args, **kwargs)
class celery.backends.base.KeyValueStoreBackend(*args, **kwargs)
chord_keyprefix = 'chord-unlock-'
delete(key)
get(key)
get_key_for_chord(taskset_id)

Get the cache key for the chord waiting on taskset with given id.

get_key_for_task(task_id)

Get the cache key for a task by id.

get_key_for_taskset(taskset_id)

Get the cache key for a taskset by id.

get_many(task_ids, timeout=None, interval=0.5)
mget(keys)
set(key, value)
task_keyprefix = 'celery-task-meta-'
taskset_keyprefix = 'celery-taskset-meta-'
celery.backends.base.unpickle_backend(cls, args, kwargs)

Returns an unpickled backend.

Previous topic

celery.backends

Next topic

celery.backends.database

This Page