【发布时间】:2021-06-06 19:20:34
【问题描述】:
我正在尝试在我的 Google App Engine 上并行运行多个功能。目前,我正在使用多处理,但它似乎不起作用,因为每当我通过 API 调用运行以下命令时,它似乎都无法引导:
from multiprocessing import Pool
result_objs = []
with Pool(processes=3) as pool:
df1 = pool.apply_async(function1, (input_postcode, input_category1))
df2 = pool.apply_async(function2, (input_postcode, input_category2))
df3 = pool.apply_async(function3, (input_postcode, input_category3))
result_objs.append(df1)
result_objs.append(df2)
result_objs.append(df3)
results = [result.get() for result in result_objs]
是因为GAE只有1个CPU吗?是因为多处理库不适用于 GAE 吗? Google 是否为多处理提供等效库? 我看过以下谷歌图书馆,但不太确定如何在我的案例中应用它?
from google.appengine.api import taskqueue
【问题讨论】:
标签: python google-app-engine multiprocessing