我们可以在GAE中运行多处理池吗? [英] Can we run multiprocessing Pool in GAE?

查看:122
本文介绍了我们可以在GAE中运行多处理池吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在gae中运行多处理池?

Is it possible to run multiprocessing Pool in gae?

如果是,我的代码如何在我的本地计算机上正常运行,但弹出以下erg msg与django远程API:

If yes, how come my code runs fine in my local machine but pops out the following err msg with django remote api:


文件
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2。 6 / multiprocessing / pool.py,
第148行,映射
返回self.map_async(func,iterable,chunksize).get()

File
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/multiprocessing/pool.py,
line 422,in get
raise self._value TypeError: init ()关键字必须是字符串

File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/multiprocessing/pool.py", line 148, in map return self.map_async(func, iterable, chunksize).get()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/multiprocessing/pool.py", line 422, in get raise self._value TypeError: init() keywords must be strings


推荐答案

您无法使用在生产服务器上运行多处理,但如果您使用的是remote_api,那么您可以在本地运行脚本(使用多处理功能),并让每个Pool进程使用remote_api调用与生产服务器通信。

You won't be able to run multiprocessing on the production servers, but if you are using the remote_api, then you can run your script locally (with multiprocessing) and have each Pool process use communicate with the production server via remote_api calls.

如果您在服务器端代码中实际需要 multiprocess 样式操作,那么Mapper API非常适合此任务。

If you need multiprocess style actions actually in server-side code, then the Mapper API is perfect for this task.

这篇关于我们可以在GAE中运行多处理池吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆