当前位置: 首页>>代码示例>>Python>>正文


Python ThreadPool.__init__方法代码示例

本文整理汇总了Python中twisted.python.threadpool.ThreadPool.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadPool.__init__方法的具体用法?Python ThreadPool.__init__怎么用?Python ThreadPool.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.python.threadpool.ThreadPool的用法示例。


在下文中一共展示了ThreadPool.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twisted.python.threadpool import ThreadPool [as 别名]
# 或者: from twisted.python.threadpool.ThreadPool import __init__ [as 别名]
    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__)
开发者ID:xlhtc007,项目名称:pyfarm-agent,代码行数:30,代码来源:log.py

示例2: __init__

# 需要导入模块: from twisted.python.threadpool import ThreadPool [as 别名]
# 或者: from twisted.python.threadpool.ThreadPool import __init__ [as 别名]
    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)
开发者ID:merveunlu,项目名称:neurons,代码行数:10,代码来源:store.py

示例3: __init__

# 需要导入模块: from twisted.python.threadpool import ThreadPool [as 别名]
# 或者: from twisted.python.threadpool.ThreadPool import __init__ [as 别名]
    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)
开发者ID:restofsun,项目名称:spyne,代码行数:12,代码来源:web.py


注:本文中的twisted.python.threadpool.ThreadPool.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。