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.
|
|
|
_WaitWhileQuiescingUnlocked(self)
Wait until the worker pool has finished quiescing. |
source code
|
|
|
|
|
AddTask(self,
args,
priority=_DEFAULT_PRIORITY,
task_id=None)
Adds a task to the queue. |
source code
|
|
|
|
|
|
|
|
|
_ShouldWorkerTerminateUnlocked(self,
worker)
Returns whether a worker should terminate. |
source code
|
|
|
_HasRunningTasksUnlocked(self)
Checks whether there's a task running in a worker. |
source code
|
|
|
HasRunningTasks(self)
Checks whether there's at least one task running. |
source code
|
|
|
Quiesce(self)
Waits until the task queue is empty. |
source code
|
|
|
_NewWorkerIdUnlocked(self)
Return an identifier for a new worker. |
source code
|
|
|
_ResizeUnlocked(self,
num_workers)
Changes the number of workers. |
source code
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|