![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | put |
def | reput |
def | get |
def | join |
def | task_done |
def | empty |
def | get_nowait |
def | qsize |
Public Attributes | |
get_time | |
queue | |
requeue | |
lock | |
put_cond | |
get_cond | |
A special thread-safe queue. A ReQueue allows unfinished work items to be returned with a call to reput(). When an item is reput, task_done() should *not* be called in addition, getting an item that has been reput does not increase the number of outstanding tasks. This class shares an interface with Queue.Queue and provides the additional reput method.
def google.appengine.tools.requeue.ReQueue.__init__ | ( | self, | |
queue_capacity, | |||
requeue_capacity = None , |
|||
queue_factory = Queue.Queue , |
|||
get_time = time.time |
|||
) |
Initialize a ReQueue instance. Args: queue_capacity: The number of items that can be put in the ReQueue. requeue_capacity: The numer of items that can be reput in the ReQueue. queue_factory: Used for dependency injection. get_time: Used for dependency injection.
def google.appengine.tools.requeue.ReQueue.empty | ( | self | ) |
Returns true if the requeue is empty.
def google.appengine.tools.requeue.ReQueue.get | ( | self, | |
block = True , |
|||
timeout = None |
|||
) |
Get an item from the requeue. Args: block: Whether to block if the requeue is empty. timeout: Maximum on how long to wait until the requeue is non-empty. Returns: An item from the requeue. Raises: Queue.Empty if the queue is empty and the timeout expires.
def google.appengine.tools.requeue.ReQueue.get_nowait | ( | self | ) |
Try to get an item from the queue without blocking.
def google.appengine.tools.requeue.ReQueue.join | ( | self | ) |
Blocks until all of the items in the requeue have been processed.
def google.appengine.tools.requeue.ReQueue.put | ( | self, | |
item, | |||
block = True , |
|||
timeout = None |
|||
) |
Put an item into the requeue. Args: item: An item to add to the requeue. block: Whether to block if the requeue is full. timeout: Maximum on how long to wait until the queue is non-full. Raises: Queue.Full if the queue is full and the timeout expires.
def google.appengine.tools.requeue.ReQueue.reput | ( | self, | |
item, | |||
block = True , |
|||
timeout = None |
|||
) |
Re-put an item back into the requeue. Re-putting an item does not increase the number of outstanding tasks, so the reput item should be uniquely associated with an item that was previously removed from the requeue and for which TaskDone has not been called. Args: item: An item to add to the requeue. block: Whether to block if the requeue is full. timeout: Maximum on how long to wait until the queue is non-full. Raises: Queue.Full is the queue is full and the timeout expires.
def google.appengine.tools.requeue.ReQueue.task_done | ( | self | ) |
Indicate that a previously enqueued item has been fully processed.