This document describes the current stable version of Celery (3.1). For development docs, go here.

celery.datastructures

Custom types and data structures.

AttributeDict

class celery.datastructures.AttributeDict[source]

Dict subclass with attribute access.

class celery.datastructures.AttributeDictMixin[source]

Augment classes with a Mapping interface by adding attribute access.

I.e. d.key -> d[key].

DictAttribute

class celery.datastructures.DictAttribute(obj)[source]

Dict interface to attributes.

obj[k] -> obj.k obj[k] = val -> obj.k = val

get(key, default=None)[source]
items()[source]
iteritems()
iterkeys()
itervalues()
keys()[source]
obj = None
setdefault(key, default)[source]
values()[source]

ConfigurationView

class celery.datastructures.ConfigurationView(changes, defaults)[source]

A view over an applications configuration dicts.

Custom (but older) version of collections.ChainMap.

If the key does not exist in changes, the defaults dicts are consulted.

Parameters:
  • changes – Dict containing changes to the configuration.
  • defaults – List of dicts containing the default configuration.
add_defaults(d)[source]
changes = None
clear()[source]

Remove all changes, but keep defaults.

defaults = None
first(*keys)[source]
get(key, default=None)[source]
items()[source]
iteritems()
iterkeys()
itervalues()
keys()[source]
setdefault(key, default)[source]
update(*args, **kwargs)[source]
values()[source]

ExceptionInfo

class celery.datastructures.ExceptionInfo(exc_info=None, internal=False)

Exception wrapping an exception and its traceback.

Parameters:exc_info – The exception info tuple as returned by sys.exc_info().
exception = None

Exception instance.

internal = False

Set to true if this is an internal error.

tb = None

Pickleable traceback instance for use with traceback

traceback = None

String representation of the traceback.

type = None

Exception type.

LimitedSet

class celery.datastructures.LimitedSet(maxlen=None, expires=None, data=None, heap=None)[source]

Kind-of Set with limitations.

Good for when you need to test for membership (a in set), but the list might become too big.

Parameters:
  • maxlen – Maximum number of members before we start evicting expired members.
  • expires – Time in seconds, before a membership expires.
add(value, now=<built-in function time>)[source]

Add a new member.

as_dict()[source]
clear()[source]

Remove all members

discard(value)[source]

Remove membership by finding value.

pop_value(value)

Remove membership by finding value.

purge(limit=None, offset=0, now=<built-in function time>)[source]

Purge expired items.

update(other, heappush=<built-in function heappush>)[source]

LRUCache

class celery.datastructures.LRUCache(limit=None)

LRU Cache implementation using a doubly linked list to track access.

Parameters:limit – The maximum number of keys to keep in the cache. When a new key is inserted and the limit has been exceeded, the Least Recently Used key will be discarded from the cache.
incr(key, delta=1)
items()
iteritems()
iterkeys()
itervalues()
keys()
update(*args, **kwargs)
values()

Previous topic

celery.app.routes

Next topic

celery.security.certificate

This Page