class documentation
class MemoryPool(threadpool.ThreadPool):
Constructor: MemoryPool(coordinator, failTest, newWorker, *args, **kwargs)
A deterministic threadpool that uses in-memory data structures to queue work rather than threads to execute work.
Method | __init__ |
Initialize this MemoryPool with a test case. |
Method | _pool |
Override testing hook to create a deterministic threadpool. |
Instance Variable | _coordinator |
Undocumented |
Instance Variable | _fail |
Undocumented |
Instance Variable | _new |
Undocumented |
Inherited from ThreadPool
:
Method | __getstate__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | adjust |
Adjust the number of available threads by setting min and max to new values. |
Method | call |
Call a callable object in a separate thread. |
Method | call |
Call a callable object in a separate thread and call onResult with the return value, or a twisted.python.failure.Failure if the callable raises an exception. |
Method | dump |
Dump some plain-text informational messages to the log about the state of this ThreadPool . |
Method | start |
Start the threadpool. |
Method | start |
Increase the number of available workers for the thread pool by 1, up to the maximum allowed by ThreadPool.max . |
Method | stop |
Shutdown the threads in the threadpool. |
Method | stop |
Decrease the number of available workers by 1, by quitting one as soon as it's idle. |
Class Variable | current |
Undocumented |
Instance Variable | joined |
Undocumented |
Instance Variable | max |
Undocumented |
Instance Variable | min |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | started |
Whether or not the thread pool is currently running. |
Instance Variable | threads |
List of workers currently running in this thread pool. |
Property | waiters |
For legacy compatibility purposes, return the number of idle workers as expressed by a list the length of that number. |
Property | workers |
For legacy compatibility purposes, return a total number of workers. |
Property | working |
For legacy compatibility purposes, return the number of busy workers as expressed by a list the length of that number. |
Method | _generate |
Generate a name for a new pool thread. |
Instance Variable | _team |
Undocumented |
Property | _queue |
For legacy compatibility purposes, return an object with a qsize method that indicates the amount of work not yet allocated to a worker. |
Initialize this MemoryPool
with a test case.
Parameters | |
coordinator:twisted._threads.IExclusiveWorker | a worker used to coordinate work in the Team underlying this threadpool. |
failFailure ) and raising unittest.FailTest . | A 1-argument callable taking an exception and raising a test-failure exception. |
newtwisted._threads.IWorker . | a 0-argument callable that produces a new twisted._threads.IWorker provider on each invocation. |
*args | Undocumented |
**kwargs | Undocumented |
Override testing hook to create a deterministic threadpool.
Parameters | |
current | A 1-argument callable which returns the current threadpool size limit. |
thread | ignored in this invocation; a 0-argument callable that would produce a thread. |
Returns | |
a Team backed by the coordinator and worker passed to MemoryPool.__init__ . |