This document describes Celery 2.3. For development docs, go here.
Custom data structures.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
Token Bucket Algorithm.
See http://en.wikipedia.org/wiki/Token_Bucket Most of this code was stolen from an entry in the ASPN Python Cookbook: http://code.activestate.com/recipes/511490/
Thread safety
This implementation may not be thread safe.
Returns True if tokens number of tokens can be consumed from the bucket.
Maximum number of tokensin the bucket.
Returns the expected time in seconds when a new token should be available.
Warning
This consumes a token from the bucket.
The rate in tokens/second that the bucket will be refilled
Timestamp of the last time a token was taken out of the bucket.
Dict subclass with attribute access.
Adds attribute access to mappings.
d.key -> d[key]
A view over an applications configuration dicts.
If the key does not exist in changes, the defaults dict is consulted.
Parameters: |
|
---|
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: |
|
---|
Add a new member.
Remove all members
Get the oldest member.
Remove membership by finding value.
Iterator yielding all immediately available items in a Queue.Queue.
The iterator stops as soon as the queue raises Queue.Empty.
Examples
>>> q = Queue()
>>> map(q.put, range(4))
>>> list(consume_queue(q))
[0, 1, 2, 3]
>>> list(consume_queue(q))
[]