开发者

Starting a long running process on a server from a WSGI application

I need to start a long running process (30 min) via http and get status as it's running. The "process" is basically a Python script that updates a database. I have the following constraints:

  1. Only one instance of the process can run at a time.

  2. The WSGI application is running in several interpreters, so I can't just make a global variable isRunning to k开发者_运维技巧eep track of it.

  3. I need a web page to track the process (status/progress)

  4. No Django, just pure WSGI.

Anyone have any experiences doing the same thing?


Isolate the process as a separate daemon, and use MQ or some other IPC to hand it jobs. Have it update a value in a database as it progresses, and read that value in a web page.


Look at using Celery (http://celeryproject.org/) and run the task outside of the Python web application processes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜