ProcessPoolExecutor 和虚拟 CPU

问题描述

这里是一段python并行计算的代码

from concurrent.futures import ProcesspoolExecutor as PE

max_Worker = 10

def data_processing(index,file_path):
  # Loading the data from file path
  # Do some processing
  # Export results in pickle,then there is no return

with PE(max_workers = max_Worker) as pe:
    for Index,File_Path in enumerate(file_List):
        pe.submit(data_processing,Index,File_Path)

并行解决方案在我的本地 PC 上运行良好,但是,它在 google 虚拟机 (vm) 实例上冻结。以下是 vm 实例的信息:

Machine type: n1-standard-8 (8 vcpus,30 GB memory)
cpu platform: Intel Haswell
OS: ubuntu-18.04

我的猜测是问题与虚拟 cpu 有关,但不确定。

感谢您对您的体验提出任何意见。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)