cli.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:cess 作者: frnsys 项目源码 文件源码
def start(self, arbiter_host, arbiter_port, start_port, cores):
        logger = logging.getLogger('cluster.worker')
        logger.addHandler(MPLogHandler('/tmp/node.log'))

        cpus = multiprocessing.cpu_count()
        if cores > 0:
            cores = min(cpus, cores)
        else:
            cores = max(1, cpus - cores)

        logger.info('starting {} workers'.format(cores))
        with ProcessPoolExecutor(max_workers=cores) as executor:
            port = start_port
            for _ in range(cores):
                executor.submit(start_worker, arbiter_host, arbiter_port, port)
                port += 1

            while True:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号