Re: cgi long running jobs

From: Thomas Guettler (guettli_at_thomas-guettler.de)
Date: 10/04/04


Date: Mon, 04 Oct 2004 16:38:44 +0200

Am Sun, 03 Oct 2004 07:01:50 -0700 schrieb Vineeth S:

> Hi,
>
> I have a web app set up, it is one long job and goes on for about 20
> or 30 seconds. When the request comes in, I throw a "please wait", set
> the job on its way, and want to periodically update the "please wait"
> thrown.
>
> What I tried initially was a client-pull, where with the first "please
> wait" I would send a refresh header with a flag as parameter, and then
> use that flag to check for completion, else send a new "please wait
> <blah>". This did not work, I am guessing, because the request and the
> subsequent process has been tied to that session, am I correct ?

Hi,

How do you check the flag?

You can do it like this:
One script or method called "startProcess": Start the
real work in background (os.system(".... 2>&1 &")).
This returns a redirect to "waitForProcess?id=..."

The second scripts redirects itself to the same URL
after 1 second (in the head tag of the html), if
the process has not completed. Otherwise return the result.
You can add some progress meter which gets updated
every second.

> Going by that reasoning, I tried a fork-exec to run the long job, and
> periodically check for completion from the parent. This does not work
> either, and this has foxed me. Is it because fork-exec in the cgi
> context has some other behaviour ?

What kind of session-management do you use?

HTH,
 Thomas



Relevant Pages

  • Re: How do you figure out how much memory a class is using?
    ... > I just wrap them in an If statement and check the flag. ... In fact I normally encapsulate all access to Session, Viewstate, Cache, ... Session for the variable... ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Virtual HID mouse driver with multi-monitor
    ... you can createa new thread for each session and attach that thread to the new desktop ... there's a flag MOUSE_VIRTUAL_DESKTOP that is supposed to map the ... absolute coordinate onto the whole virtual desktop (instead of the ... values you need to send and tell the driver using an IOCTL. ...
    (microsoft.public.development.device.drivers)
  • Re: Track the users on line?
    ... It closes the session after the number of minutes specified in web.config ... A user login, update table flag to know that user has logged into the system. ... If he try again to log from a new browser, the check for the flag doesn't allow the access. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Track the users on line?
    ... But doesn't the session close the channel when the user close the browser? ... A user login, update table flag to know that user has logged into the system. ... If he try again to log from a new browser, the check for the flag doesn't allow the access. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [PHP] Re: header( refresh ), form data, and IE
    ... with the correct data. ... I've now decided to shove all form data into session ... globals, and just refresh with a 'load_previous' flag in the URL. ...
    (php.general)