流程池:Zombie Process&&主要流程鸿

时间:2016-06-08 03:16:01

标签: python python-2.7 python-multiprocessing

使用多处理python模块,我得到了大量的Zombie进程,我的主应用程序永远不会结束。

代码非常简单 来自多处理导入池

  def __name__ == '__main__':
     thread_pool = Pool(5)
     full_path = ['c:/abc/abc.json', 'c:/abc/abc1.json'] # This goes on for 30 files
     final_output = thread_pool.map(do_work, full_path)
     thread_pool.close()
     thread_pool.join()

def do_work(full_path):
  i = 0
  huge_data = json.loads(full_path)
  for element in huge_data:
     if(element['flag'] == '1'):
         i = i +1
  return ({"Total": i})

0 个答案:

没有答案