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, **kwargs)[source]¶ -
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.
mark_as_done
(task_id, result, request=None)[source]¶ Mark task as successfully executed.
-
BaseBackend.
mark_as_failure
(task_id, exc, traceback=None, request=None)[source]¶ Mark task as executed with failure. Stores the execption.
-
BaseBackend.
mark_as_retry
(task_id, exc, traceback=None, request=None)[source]¶ Mark task as being retries. Stores the current exception (if any).
-
BaseBackend.
persistent
= True¶ Set to true if the backend is peristent by default.
-
BaseBackend.
reload_group_result
(group_id)[source]¶ Reload group result, even if it has been previously fetched.
-
BaseBackend.
reload_task_result
(task_id)[source]¶ Reload task result, even if it has been previously fetched.
-
BaseBackend.
retry_policy
= {'interval_start': 0, 'interval_max': 1, 'max_retries': 20, 'interval_step': 1}¶
-
BaseBackend.
store_result
(task_id, result, status, traceback=None, request=None, **kwargs)[source]¶ Update task state and result.
-
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_autoexpire
= False¶ If true the backend must automatically expire results. The daily backend_cleanup periodic task will not be triggered in this case.
-
BaseBackend.
supports_native_join
= False¶ If true the backend must implement
get_many()
.
-
BaseBackend.
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-'¶
-