def run(self):
cls = MultiprocessRunner
started = False
if self not in cls.running_instances:
cls.running_instances.add(self)
if not cls.executor_instance:
self.executor = futures.ProcessPoolExecutor(
max_workers=self.max_workers)
cls.executor_instance = self
started = True
elif not cls.executor_instance.running:
cls.executor_instance.executor = futures.ProcessPoolExecutor(
max_workers=self.max_workers)
started = True
self.executor = cls.executor_instance.executor
if started:
workers = self.executor._max_workers # Derived from cpu_count()
logging.debug(
_("Starting the MultiprocessRunner executor with %s worker "
"processes.") % workers)
评论列表
文章目录