def hard_blow():
# Note: This method might perform more tasks then `num_tasks`,
# if the values of `num_tasks`, `num_threads` are chosen such that they
# are not multiples of `num_procs`
# TODO: WIP
num_tasks = 10000
num_procs = 4
threads_per_proc = 10
tasks_per_proc = int(math.ceil(num_tasks / num_procs))
futrs = []
with ProcessPoolExecutor(max_workers=num_procs) as pe:
for _ in range(num_procs):
fut = pe.submit(_task_for_proc, (threads_per_proc, tasks_per_proc))
futrs.append(fut)
print('Waiting for futures: main')
concurrent.futures.wait(futrs)
评论列表
文章目录