backends.base

Result backend base classes.

Module Contents

Classes

_nulldict()
Backend(self,app,serializer=None,max_cached_results=None,accept=None,expires=None,expires_type=None,url=None,**kwargs)
SyncBackendMixin()
BaseBackend() Base (synchronous) result backend.
BaseKeyValueStoreBackend(self,*args,**kwargs)
KeyValueStoreBackend() Result backend base class for key/value stores.
DisabledBackend() Dummy result backend.

Functions

unpickle_backend(cls,args,kwargs) Return an unpickled backend.
unpickle_backend(cls, args, kwargs)

Return an unpickled backend.

class _nulldict
ignore(*a, **kw)
class Backend(app, serializer=None, max_cached_results=None, accept=None, expires=None, expires_type=None, url=None, **kwargs)
__init__(app, serializer=None, max_cached_results=None, accept=None, expires=None, expires_type=None, url=None, **kwargs)
as_uri(include_password=False)

Return the backend as an URI, sanitizing the password or not.

mark_as_started(task_id, **meta)

Mark a task as started.

mark_as_done(task_id, result, request=None, store_result=True, state=None)

Mark task as successfully executed.

mark_as_failure(task_id, exc, traceback=None, request=None, store_result=True, call_errbacks=True, state=None)

Mark task as executed with failure.

_call_task_errbacks(request, exc, traceback)
mark_as_revoked(task_id, reason="", request=None, store_result=True, state=None)
mark_as_retry(task_id, exc, traceback=None, request=None, store_result=True, state=None)

Mark task as being retries.

Note:
Stores the current exception (if any).
chord_error_from_stack(callback, exc=None)
fail_from_current_stack(task_id, exc=None)
prepare_exception(exc, serializer=None)

Prepare exception for serialization.

exception_to_python(exc)

Convert serialized exception to Python exception.

prepare_value(result)

Prepare value for storage.

encode(data)
_encode(data)
meta_from_decoded(meta)
decode_result(payload)
decode(payload)
prepare_expires(value, type=None)
prepare_persistent(enabled=None)
encode_result(result, state)
is_cached(task_id)
store_result(task_id, result, state, traceback=None, request=None, **kwargs)

Update task state and result.

forget(task_id)
_forget(task_id)
get_state(task_id)

Get the state of a task.

get_traceback(task_id)

Get the traceback for a failed task.

get_result(task_id)

Get the result of a task.

get_children(task_id)

Get the list of subtasks sent by a task.

_ensure_not_eager()
get_task_meta(task_id, cache=True)
reload_task_result(task_id)

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

reload_group_result(group_id)

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

get_group_meta(group_id, cache=True)
restore_group(group_id, cache=True)

Get the result for a group.

save_group(group_id, result)

Store the result of an executed group.

delete_group(group_id)
cleanup()

Backend cleanup.

Note:
This is run by celery.task.DeleteExpiredTaskMetaTask.
process_cleanup()

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

on_task_call(producer, task_id)
add_to_chord(chord_id, result)
on_chord_part_return(request, state, result, **kwargs)
fallback_chord_unlock(header_result, body, countdown=1, **kwargs)
ensure_chords_allowed()
apply_chord(header_result, body, **kwargs)
current_task_children(request=None)
__reduce__(args=tuple, kwargs=dict)
class SyncBackendMixin
iter_native(result, timeout=None, interval=0.5, no_ack=True, on_message=None, on_interval=None)
wait_for_pending(result, timeout=None, interval=0.5, no_ack=True, on_message=None, on_interval=None, callback=None, propagate=True)
wait_for(task_id, timeout=None, interval=0.5, no_ack=True, on_interval=None)

Wait for task and return its result.

If the task raises an exception, this exception will be re-raised by wait_for().

Raises:
celery.exceptions.TimeoutError:
If timeout is not None, and the operation takes longer than timeout seconds.
add_pending_result(result, weak=False)
remove_pending_result(result)
is_async()
class BaseBackend

Base (synchronous) result backend.

class BaseKeyValueStoreBackend(*args, **kwargs)
__init__(*args, **kwargs)
_encode_prefixes()
get(key)
mget(keys)
set(key, value)
delete(key)
incr(key)
expire(key, value)
get_key_for_task(task_id, key="")

Get the cache key for a task by id.

get_key_for_group(group_id, key="")

Get the cache key for a group by id.

get_key_for_chord(group_id, key="")

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

_strip_prefix(key)

Take bytes: emit string.

_filter_ready(values, READY_STATES=None)
_mget_to_results(values, keys)
get_many(task_ids, timeout=None, interval=0.5, no_ack=True, on_message=None, on_interval=None, max_iterations=None, READY_STATES=None)
_forget(task_id)
_store_result(task_id, result, state, traceback=None, request=None, **kwargs)
_save_group(group_id, result)
_delete_group(group_id)
_get_task_meta_for(task_id)

Get task meta-data for a task by id.

_restore_group(group_id)

Get task meta-data for a task by id.

_apply_chord_incr(header_result, body, **kwargs)
on_chord_part_return(request, state, result, **kwargs)
class KeyValueStoreBackend

Result backend base class for key/value stores.

class DisabledBackend

Dummy result backend.

store_result(*args, **kwargs)
ensure_chords_allowed()
_is_disabled(*args, **kwargs)
as_uri(*args, **kwargs)