web interface

John J. Lee jjl at pobox.com
Tue Nov 8 15:19:33 EST 2005


Jorge Godoy <godoy at ieee.org> writes:

> "Ajar" <ajartaknev at gmail.com> writes:
> 
> > I have a stand alone application which does some scientific
> > computations. I want to provide a web interface for this app. The app
> > is computationally intensive and may take long time for running. Can
> > someone suggest me a starting point for me? (like pointers to the
> > issues involved in this, or even better any of the existing tools for
> > doing this...)
> 
> For the long running task you might get some idea from cvsmonitor (Perl
> code).  It has a long running task that is updating some repositories and
> giving feedback from time to time to the user.
> 
> One thing is: detach all what is possible from user interface and give
> feedback from time to time to avoid browser timeout and the user thinking the
> app hanged.

If you're using CGI:

You usually have to start the long job by asking a separate server
process to do it -- eg. using XML RPC.  Otherwise, you'll get browser
timeouts (and maybe web server timeouts too).  Your little server
process can then do e.g. os.fork (unix) or subprocess.CreateProcess
(win32) (subprocess is only available in Python 2.4) to actually start
your long job.  Use a Refresh header (use a META HTML element, or set
up your web server appropriately) in your "waiting for job to finish"
web page (or reload the page from JS code) to poll the server to see
if the job has completed.


John




More information about the Python-list mailing list