How to run a task outside web2py and retrieve the output [duplicate]

▼魔方 西西 提交于 2019-12-11 02:13:31

问题


Getting extended processing times inside web2py when running clustering algorithms.

Tried running the algorithm on a standalone python instance and it finishes in 4-5s, in web2py, it takes over 10 minutes.

How do I pass the parameters from web2py user input to run the algorithm on a separate python instance, finish in 4-5s and return the results to web2py user view?


回答1:


You should use http://docs.python.org/2/library/subprocess.html#module-subprocess to a brand new Python instance and passing parameter through stdin / stdou using pickling (serialization).



来源:https://stackoverflow.com/questions/17808815/how-to-run-a-task-outside-web2py-and-retrieve-the-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!