如何在 web2py 之外运行任务并检索输出 [英] How to run a task outside web2py and retrieve the output
问题描述
在运行聚类算法时在 web2py 中获得更长的处理时间.
Getting extended processing times inside web2py when running clustering algorithms.
尝试在独立的 python 实例上运行该算法,它在 4-5 秒内完成,在 web2py 中,它需要 10 多分钟.
Tried running the algorithm on a standalone python instance and it finishes in 4-5s, in web2py, it takes over 10 minutes.
如何传递来自 web2py 用户输入的参数以在单独的 python 实例上运行算法,在 4-5 秒内完成并将结果返回给 web2py 用户视图?
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?
推荐答案
你应该使用 http://docs.python.org/2/library/subprocess.html#module-subprocess 到一个全新的 Python 实例并通过 stdin
/ 传递参数stdou
使用酸洗(序列化).
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).
这篇关于如何在 web2py 之外运行任务并检索输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!