Python之并行

最近比较喜欢的一个并行实现,可以实时查看结果:

from concurrent.futures import ProcessPoolExecutor, as_completed

executor = ProcessPoolExecutor(max_workers=5)
tasks = [executor.submit(run_func, server) for arg in args]

results = {}

for future in as_completed(tasks):
    result = future.result()
    results.append(result)
   

 

http://www.open-open.com/news/view/1c0179b/

posted @ 2017-04-24 11:17  Shiyu_Huang  阅读(232)  评论(0)    收藏  举报