celery.backends.base

celery.backends.base

Result backend base classes.

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_status(task_id)[源代码]

    Get the status 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)[源代码]

    Mark task as successfully executed.

  • 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_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, 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.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*)

  • store_result(\args, **kwargs*)[源代码]

  • wait_for(\args, **kwargs*)