Communicate With Backend Job From Web Server Or Web Page
Solution 1:
I do this in a number of projects. A web-app (mostly Python/CGI) that spawns a separate python script (using subprocess) which instantly daemonizes itself to do the work. The web-app then continues to issue AJAX requests to check on the daemon process progress (I use simple txt files for communication, database would probably be better). One nice touch is to have the daemon email the end user once it finishes (with a link to retrieve results). This way the user can close their web browser on those jobs that take hours.
Solution 2:
I'm not sure if I understood your problem correctly, but I assume you have multiple "jobs" that can run simultaneously and want them to show on web page whether they are complete or not?
When launching a job the web page (python & mod_wsgi for example) would launch a python script that would enter the job into, let's say sqlite database and run the job, once the job completes, the script updates the entry for the job so that it is marked as complete
The status page would just show the stuff from the sqlite.
What you want to put in to the DB in addition to the job ID and perhaps start/end times depends on what you want to show on your job status web page
On a sidenote - if the "jobs" are compilations, meet Hudson
Post a Comment for "Communicate With Backend Job From Web Server Or Web Page"