This document describes the current stable version of Celery (3.1). For development docs, go here.
celery.backends.base¶
celery.backends.base¶
Result backend base classes.
BaseBackend
defines the interface.KeyValueStoreBackend
is a common base class using K/V semantics like _get and _put.
-
class
celery.backends.base.
BaseBackend
(app, serializer=None, max_cached_results=None, accept=None, url=None, **kwargs)[source]¶ -
EXCEPTION_STATES
= frozenset(['FAILURE', 'RETRY', 'REVOKED'])¶
-
READY_STATES
= frozenset(['FAILURE', 'REVOKED', 'SUCCESS'])¶
-
exception
TimeoutError
¶ The operation timed out.
-
UNREADY_STATES
= frozenset(['STARTED', 'RECEIVED', 'RETRY', 'PENDING'])¶
-
as_uri
(include_password=False)[source]¶ Return the backend as an URI, sanitizing the password or not
-
mark_as_failure
(task_id, exc, traceback=None, request=None)[source]¶ Mark task as executed with failure. Stores the exception.
-
mark_as_retry
(task_id, exc, traceback=None, request=None)[source]¶ Mark task as being retries. Stores the current exception (if any).
-
persistent
= True¶ Set to true if the backend is peristent by default.
-
retry_policy
= {'interval_start': 0, 'interval_max': 1, 'max_retries': 20, 'interval_step': 1}¶
-
store_result
(task_id, result, status, traceback=None, request=None, **kwargs)[source]¶ Update task state and result.
-
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.
-
supports_autoexpire
= False¶ If true the backend must automatically expire results. The daily backend_cleanup periodic task will not be triggered in this case.
-
supports_native_join
= False¶ If true the backend must implement
get_many()
.
-
wait_for
(task_id, timeout=None, interval=0.5, no_ack=True, on_interval=None)[source]¶ 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 thecelery.exceptions.TimeoutError
exception if the operation takes longer than timeout seconds.
-
-
class
celery.backends.base.
KeyValueStoreBackend
(*args, **kwargs)[source]¶ -
chord_keyprefix
= 'chord-unlock-'¶
-
get_key_for_chord
(group_id, key='')[source]¶ Get the cache key for the chord waiting on group with given id.
-
get_many
(task_ids, timeout=None, interval=0.5, no_ack=True, READY_STATES=frozenset(['FAILURE', 'REVOKED', 'SUCCESS']))[source]¶
-
group_keyprefix
= 'celery-taskset-meta-'¶
-
implements_incr
= False¶
-
key_t
(s)¶
-
task_keyprefix
= 'celery-task-meta-'¶
-
-
class
celery.backends.base.
DisabledBackend
(app, serializer=None, max_cached_results=None, accept=None, url=None, **kwargs)[source]¶ -
-
get_many
(*args, **kwargs)¶
-
get_result
(*args, **kwargs)¶
-
get_state
(*args, **kwargs)¶
-
get_status
(*args, **kwargs)¶
-
get_traceback
(*args, **kwargs)¶
-
wait_for
(*args, **kwargs)¶
-