使用多处理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})