celery.backends.base

    • 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*)

    • 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.apply_chord(header, partial_args, group_id, body, \*options*)

    • BaseBackend.cleanup()[源代码]

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

    • BaseBackend.current_task_children(request=None)

    • BaseBackend.decode(payload)[源代码]

    • BaseBackend.delete_group(group_id)

    • BaseBackend.encode(data)[源代码]

    • BaseBackend.encode_result(result, status)

    • BaseBackend.exception_to_python(exc)[源代码]

      Convert serialized exception to Python exception.

    • BaseBackend.fail_from_current_stack(task_id, exc=None)

    • BaseBackend.fallback_chord_unlock(group_id, body, result=None, countdown=1, \*kwargs*)[源代码]

    • BaseBackend.forget(task_id)

    • BaseBackend.get_children(task_id)[源代码]

      Get the list of subtasks sent by a task.

    • BaseBackend.get_group_meta(group_id, cache=True)

    • BaseBackend.get_result(task_id)

      Get the result of a task.

    • BaseBackend.get_task_meta(task_id, cache=True)

    • BaseBackend.get_traceback(task_id)[源代码]

      Get the traceback for a failed task.

    • BaseBackend.is_cached(task_id)

    • BaseBackend.mark_as_done(task_id, result, request=None)[源代码]

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

      Mark task as executed with failure. Stores the execption.

    • BaseBackend.mark_as_retry(task_id, exc, traceback=None, request=None)[源代码]

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

    • BaseBackend.mark_as_revoked(task_id, reason=’’, request=None)

    • BaseBackend.mark_as_started(task_id, \*meta*)[源代码]

      Mark a task as started

    • BaseBackend.on_chord_part_return(task, propagate=False)

    • BaseBackend.on_task_call(producer, task_id)

    • BaseBackend.persistent = True

      Set to true if the backend is peristent by default.

    • BaseBackend.prepare_exception(exc)[源代码]

      Prepare exception for serialization.

    • BaseBackend.prepare_expires(value, type=None)

    • BaseBackend.prepare_persistent(enabled=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_group_result(group_id)[源代码]

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

    • BaseBackend.reload_task_result(task_id)

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

    • BaseBackend.restore_group(group_id, cache=True)[源代码]

      Get the result for a group.

    • BaseBackend.save_group(group_id, result)

      Store the result of an executed group.

    • BaseBackend.store_result(task_id, result, status, traceback=None, request=None, \*kwargs*)[源代码]

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

    class celery.backends.base.KeyValueStoreBackend(\args, **kwargs*)[源代码]

    • chord_keyprefix = ‘chord-unlock-‘

    • delete(key)

    • expire(key, value)[源代码]

    • get(key)

    • get_key_for_chord(group_id)[源代码]

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

    • get_key_for_group(group_id)

      Get the cache key for a group by id.

    • get_key_for_task(task_id)[源代码]

      Get the cache key for a task by id.

    • get_many(task_ids, timeout=None, interval=0.5, READY_STATES=frozenset([‘FAILURE’, ‘REVOKED’, ‘SUCCESS’]))

    • group_keyprefix = ‘celery-taskset-meta-‘

    • implements_incr = False

    • incr(key)[源代码]

    • key_t(s)

    • mget(keys)

    • on_chord_part_return(task, propagate=None)[源代码]

    • set(key, value)

    • task_keyprefix = ‘celery-task-meta-‘

    class celery.backends.base.DisabledBackend(app, serializer=None, max_cached_results=None, accept=None, \*kwargs*)[源代码]

    • get_result(\args, **kwargs*)

    • get_status(\args, **kwargs*)

    • get_traceback(\args, **kwargs*)