Go to the latest version of this document.

# ``twisted`.`trial`.`_dist`.`disttrial`.`WorkerPool``

class documentation

`class WorkerPool: (source)`

View In Hierarchy

Manage a fixed-size collection of child processes which can run tests.

Async Method | `start` | Launch all of the workers for this pool.
Method | `_createLocalWorkers` | Create local worker protocol instances and return them.
Method | `_launchWorkerProcesses` | Spawn processes from a list of process protocols.
Instance Variable | `_config` | Configuration for the precise way in which the pool is run.

async def start(self, reactor: `IReactorProcess`) -> `StartedWorkerPool`: (source)

Launch all of the workers for this pool.

Returns
`StartedWorkerPool` | A started pool object that can run jobs using the workers.

def _createLocalWorkers(self, protocols: `Iterable[LocalWorkerAMP]`, workingDirectory: `FilePath[Any]`, logFile: `TextIO`) -> `list[LocalWorker]`: (source)

Create local worker protocol instances and return them.

Parameters
protocols:`Iterable[LocalWorkerAMP]` | The process/protocol adapters to use for the created workers.
workingDirectory:`FilePath[Any]` | The base path in which we should run the workers.
logFile:`TextIO` | The test log, for workers to write to.

Returns
`list[LocalWorker]` | A list of `quantity` `LocalWorker` instances.

def _launchWorkerProcesses(self, spawner, protocols, arguments): (source)

Spawn processes from a list of process protocols.

Parameters
spawner | A `IReactorProcess.spawnProcess` implementation.
protocols | An iterable of `ProcessProtocol` instances.
arguments | Extra arguments passed to the processes.

_config: `WorkerPoolConfig` = (source)

Configuration for the precise way in which the pool is run.