[cgiapp] Streaming Status Updates for a Long-running Run Mode

Michael Peters mpeters at plusthree.com
Wed Oct 7 11:28:21 EDT 2009


On 10/07/2009 10:33 AM, eric.berg at barclayscapital.com wrote:

> How can I update my web page with status from this run mode while the
> subprocesses are running?

There's a couple of different ways this can be done. The best is 
definitely not the easiest but it means creating a separate offline job 
queue that can run these processes and keep their status in a shared 
location (like a DB, etc). Then your rm just adds a job to the queue and 
returns. Then when you're checking on the status via Ajax you need to 
have another rm that simply checks on the status of the job and returns 
a flag that could mean success, failure, or try again later (still working).

Unfortunately, since you are using Ajax, you can't use the standard NPH 
approach and just periodically print something to the browser while it's 
working. Ajax requests don't return (in the javascript) until the entire 
request is done and it will probably timeout on you.

-- 
Michael Peters
Plus Three, LP


More information about the cgiapp mailing list