This document describes an older version of Celery (2.5). For the latest stable version please go here.

celery.datastructures

Custom types and data structures.

copyright:
  1. 2009 - 2012 by Ask Solem.
license:

BSD, see LICENSE for more details.

AttributeDict

class celery.datastructures.AttributeDict

Dict subclass with attribute access.

class celery.datastructures.AttributeDictMixin

Adds attribute access to mappings.

d.key -> d[key]

DictAttribute

class celery.datastructures.DictAttribute(obj)

Dict interface to attributes.

obj[k] -> obj.k

get(key, default=None)
items()
iteritems()
setdefault(key, default)

ConfigurationView

class celery.datastructures.ConfigurationView(changes, defaults)

A view over an applications configuration dicts.

If the key does not exist in changes, the defaults dict is consulted.

Parameters:
  • changes – Dict containing changes to the configuration.
  • defaults – Dict containing the default configuration.
changes = None
defaults = None
get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
setdefault(key, default)
update(*args, **kwargs)
values()

ExceptionInfo

class celery.datastructures.ExceptionInfo(exc_info, 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)

Kind-of Set with limitations.

Good for when you need to test for membership (a in set), but the list might become to big, so you want to limit it so it doesn’t consume too much resources.

Parameters:
  • maxlen – Maximum number of members before we start evicting expired members.
  • expires – Time in seconds, before a membership expires.
add(value)

Add a new member.

as_dict()
chronologically
clear()

Remove all members

expires
first

Get the oldest member.

maxlen
pop_value(value)

Remove membership by finding value.

update(other)

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()
itervalues()
keys()
values()

Previous topic

celery.security.serialization

Next topic

celery.routes

This Page