Package buildbot :: Package db :: Module pool :: Class DBThreadPool
[frames] | no frames]

Class DBThreadPool

source code

twisted.python.threadpool.ThreadPool --+
                                       |
                                      DBThreadPool

A pool of threads ready and waiting to execute queries.

If the engine has an optimal_thread_pool_size attribute, then the maxthreads of the thread pool will be set to that value. This is most useful for SQLite in-memory connections, where exactly one connection (and thus thread) should be used.

Nested Classes

Inherited from twisted.python.threadpool.ThreadPool: threadFactory

Instance Methods
 
__init__(self, engine)
Create a new threadpool.
source code
 
shutdown(self)
Manually stop the pool.
source code
 
do_081(self, callable, *args, **kwargs) source code
 
do_with_engine_081(self, callable, *args, **kwargs) source code
 
do(self, callable, *args, **kwargs)
Call callable in a thread, with a Connection as first argument.
source code
 
do_with_engine(self, callable, *args, **kwargs)
Like do, but with an SQLAlchemy Engine as the first argument.
source code
 
detect_bug1810(self) source code
 
get_sqlite_version(self) source code

Inherited from twisted.python.threadpool.ThreadPool: __getstate__, __setstate__, adjustPoolsize, callInThread, callInThreadWithCallback, dispatch, dispatchWithCallback, dumpStats, start, startAWorker, stop, stopAWorker

Static Methods

Inherited from twisted.python.threadpool.ThreadPool: currentThread

Class Variables
  running = False

Inherited from twisted.python.threadpool.ThreadPool: joined, max, min, name, started, workers

Method Details

__init__(self, engine)
(Constructor)

source code 

Create a new threadpool.

Parameters:
  • minthreads - minimum number of threads in the pool
  • maxthreads - maximum number of threads in the pool
Overrides: twisted.python.threadpool.ThreadPool.__init__
(inherited documentation)

shutdown(self)

source code 

Manually stop the pool. This is only necessary from tests, as the pool will stop itself when the reactor stops under normal circumstances.

do(self, callable, *args, **kwargs)

source code 

Call callable in a thread, with a Connection as first argument. Returns a deferred that will indicate the results of the callable.

Note: do not return any SQLAlchemy objects via this deferred!

do_with_engine(self, callable, *args, **kwargs)

source code 

Like do, but with an SQLAlchemy Engine as the first argument. This is only used for schema manipulation, and is not used at master runtime.