Package npsgd :: Module task_queue :: Class TaskQueue
[hide private]
[frames] | no frames]

Class TaskQueue

source code

object --+
         |
        TaskQueue

Main queue object (thread safe).

Contains two internal queues: one for actually holding requests, and one for holding the tasks that are currently being processed. This way, if a task fails to process we can cycle it back into the requests queue a few times to see if the error was transient.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
allRequests(self)
Returns all requests in processing or requests queue.
source code
 
putTask(self, request)
Puts a model into the queue for worker processing.
source code
 
putTaskHead(self, request)
Puts a model into queue at the head (useful for peeking).
source code
 
putProcessingTask(self, task)
Puts a model into the queue for worker processing.
source code
 
pullNextVersioned(self, modelVersions)
Pulls the next model from the worker queue that matches versions.
source code
 
pullNextTask(self)
Pulls a model from the worker queue.
source code
 
touchProcessingTaskById(self, taskId)
Update timestamp on a task that is currently processing.
source code
 
hasProcessingTaskById(self, taskId) source code
 
pullProcessingTasksOlderThan(self, oldTime)
Pulls tasks out of the processing queue that are stale.
source code
 
pullProcessingTaskById(self, taskId) source code
 
isEmpty(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

allRequests(self)

source code 

Returns all requests in processing or requests queue.

This is really only useful for serializing the queue to disk.