def __init__(self): minthreads = config["jobtype_logging_threadpool"]["min_threads"] maxthreads = config["jobtype_logging_threadpool"]["max_threads"] self.max_queued_lines = \ config["jobtype_logging_threadpool"]["max_queue_size"] self.flush_lines = \ config["jobtype_logging_threadpool"]["flush_lines"] self.stopped = False if minthreads < 1: raise ValueError( "Config value " "jobtype_logging_threadpool.min_threads must be >= 1") # Calculate maxthreads if a value was not provided for us if maxthreads == "auto": auto_maxthreads = min(int(cpu.total_cpus() * 1.5), 20) maxthreads = max(auto_maxthreads, minthreads) if minthreads > maxthreads: raise ValueError( "Config value jobtype_logging_threadpool.min_threads cannot " "be larger than jobtype_logging_threadpool.max_threads") ThreadPool.__init__( self, minthreads=minthreads, maxthreads=maxthreads, name=self.__class__.__name__)
def __init__(self, engine, maxthreads=10, verbose=False): if engine.dialect.name == 'sqlite': ThreadPool.__init__(self, minthreads=1, maxthreads=1) else: ThreadPool.__init__(self, maxthreads=maxthreads) self.engine = engine reactor.callWhenRunning(self.start)
def __init__(self, engine, verbose=False): if engine.dialect.name == "sqlite": pool_size = 1 ThreadPool.__init__(self, minthreads=1, maxthreads=1) else: ThreadPool.__init__(self) self.engine = engine reactor.callWhenRunning(self.start)