twisted._threads.Team(object) class documentationtwisted._threads
(View In Hierarchy)
Implements interfaces: .IWorker
A composite IWorker 
implementation.
| Method | __init__ | No summary | 
| Method | statistics | Gather information on the current status of this Team. | 
| Method | grow | Increase the the number of idle workers by n. | 
| Method | shrink | Decrease the number of idle workers by n. | 
| Method | do | Perform some work in a worker created by createWorker. | 
| Method | quit | Stop doing work and shut down all idle workers. | 
| Instance Variable | _quit | A Quitflag indicating whether thisTeamhas been quit yet.
This may be set by an arbitrary thread sinceTeam.quitmay be 
called from anywhere. | 
| Instance Variable | _coordinator | the IExclusiveWorkercoordinating access to thisTeam's internal 
resources. | 
| Instance Variable | _createWorker | a callable that will create new workers. | 
| Instance Variable | _logException | a 0-argument callable called in an exception context when there is an 
unhandled error from a task passed to Team.do | 
| Instance Variable | _idle | a setof idle workers. | 
| Instance Variable | _busyCount | the number of workers currently busy. | 
| Instance Variable | _pending | a dequeof tasks - that is, 0-argument callables passed toTeam.do- that are 
outstanding. | 
| Instance Variable | _shouldQuitCoordinator | A flag indicating that the coordinator should be quit at the next available
opportunity.  Unlike Team._quit, this 
flag is only set by the coordinator. | 
| Instance Variable | _toShrink | the number of workers to shrink this Teamby at the next 
available opportunity; set in the coordinator. | 
| Method | _quitIdlers | The implmentation of shrink, performed by the coordinator 
worker. | 
| Method | _coordinateThisTask | Select a worker to dispatch to, either an idle one or a new one, and perform it. | 
| Method | _recycleWorker | Called only from coordinator. | 
Team.do
deque of tasks - that is, 0-argument callables passed to Team.do - that are 
outstanding.
  Team._quit, this 
flag is only set by the coordinator.
  Team by at the next 
available opportunity; set in the coordinator.
  | Parameters | coordinator | an IExclusiveWorkerwhich will coordinate access to resources on thisTeam; that is to say, anIExclusiveWorkerwhosedomethod ensures that its given work will be executed 
in a mutually exclusive context, not in parallel with other work enqueued 
bydo(although possibly in parallel with the caller). | 
| createWorker | A 0-argument callable that will create an IWorkerto perform 
work. | |
| logException | A 0-argument callable called in an exception context when the work passed 
to doraises an exception. | 
Gather information on the current status of this Team.
| Returns | a Statisticsdescribing the current state of thisTeam. | |
Increase the the number of idle workers by n.
| Parameters | n | The number of new idle workers to create. (type: int) | 
The implmentation of shrink, performed by the coordinator 
worker.
| Parameters | n | see Team.shrink | 
Perform some work in a worker created by createWorker.
| Parameters | task | the callable to run | 
Select a worker to dispatch to, either an idle one or a new one, and perform it.
This method should run on the coordinator worker.
| Parameters | task | the task to dispatch (type: 0-argument callable) | 
Called only from coordinator.
Recycle the given worker into the idle pool.
| Parameters | worker | a worker created by createWorkerand now idle. (type:IWorker) |