eric at ericwalstad.com
Wed Jun 2 11:27:38 EDT 2004
Hi Grisha and the gang... On Wednesday 02 June 2004 09:43, Gregory (Grisha) Trubetskoy wrote: > On Tue, 1 Jun 2004, Eric Walstad wrote: > > Do any of you have advice for a good way to keep the user from having to > > wait for long processes to finish before seeing a response from > > mod_python? > > Here is another idea - instead of spawning, register it as a cleanup > (req.register_cleanup()). It will execute within the Apache process, but > after the request is processed, and shouldn't really interfere with > anything. Thanks to you, Mike and Gus for your replies. req.register_cleanup() looks like a good match. I doubt I would have ever found register_cleanup on my own! Do you have any tips on how to tell when the cleanup process has completed? I'm currently checking for the existence of the generated iso file, but there's a brief period where the file exists (os.path.exists) but has not been completely written yet. That's probably not a problem, but might be if I try to stream the file to the client while it's being written by mkisofs (that's my next hurdle). Checking os.path.exists just feels like a bit of a hack, that's all. Any thoughts? If register_cleanup doesn't work, I'll give "nohup sudo 'mycommand' &" a try and live with the "exists" hack. Thanks again for your help. Best regards, Eric.