Trees | Indices | Help |
|
---|
|
Worker pool with a queue.
This class is thread-safe.
Tasks are guaranteed to be started in the order in which they're added to the pool. Due to the nature of threading, they're not guaranteed to finish in the same order.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
dict; (task IDs as keys, tuples as values) |
_taskdata Mapping from task IDs to entries in _tasks |
||
list of tuples |
_tasks Each tuple has the format (priority, order ID, task ID, arguments). |
|
|||
Inherited from |
|
Constructor for worker pool.
|
Adds a task to the internal queue.
|
Adds a task to the queue.
Note: The task ID can be essentially anything that can be used as a dictionary key. Callers, however, must ensure a task ID is unique while a task is in the pool or while it might return to the pool due to deferring using DeferTask. |
Add a list of tasks to the queue.
Note: See AddTask for a note on task IDs. |
Changes a task's priority.
|
Waits for a task for a worker.
|
Changes the number of workers in the pool.
|
Terminate all worker threads. Unstarted tasks will be ignored. |
|
_tasksEach tuple has the format (priority, order ID, task ID, arguments). Priority and order ID are numeric and essentially control the sort order. The order ID is an increasing number denoting the order in which tasks are added to the queue. The task ID is controlled by user of workerpool, see AddTask for details. The task arguments areNone for abandoned tasks, otherwise a sequence of arguments
to be passed to BaseWorker.RunTask). The list must fulfill the heap
property (for use by the heapq module).
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Aug 22 11:06:34 2016 | http://epydoc.sourceforge.net |