def _all(func, hosts):
'''
Internal function that allow function to perform in all hosts
'''
all_instances = []
# threads should likely scale with cores or interfaces
cpus = multiprocessing.cpu_count()
threads = 4 * cpus
log.debug('multi._all cpus count={}, thread count={}'.format(cpus, threads))
pool = multiprocessing.dummy.Pool(threads)
for instance in pool.map(func, hosts):
all_instances.append(instance)
return all_instances
评论列表
文章目录