[mod_python] Re: forks, daemons and other beasts

Graham Dumpleton grahamd at dscpl.com.au
Sat Feb 11 17:21:17 EST 2006


On 12/02/2006, at 9:02 AM, Daniel Nogradi wrote:

>>> Anyway, I have the feeling that there must be a more sane and  
>>> probably
>>> safe way of achieving what I would like by a much simpler method.
>>>
>>> Any ideas?
>>
>> A quick one.
>>
>> Run a small separate daemon process which embeds an  XML-RPC
>> server and have your web pages use XML-RPC to call that daemon
>> process to trigger off the task. The daemon process can still fork  
>> exec
>> as necessary.
>>
>> This way you eliminate a fork in Apache child process which may be
>> problematic because of the socket connections etc that are inherited.
>
> Well, that still looks like to me that I'm shooting a bird with a
> cannon. The reason is that I need to do something really simple: users
> upload a zip file (remember my questions about the zipfile module? :))
> and should get an acknowledgement that the upload was successful. The
> server should start unpacking the archive, check if the files are okay
> and move them to a directory. All of this can take quite long, so the
> acknowledgement should be sent before this unpacking/checking/moving
> finishes.

The suggestion I gave wouldn't preclude an acknowledgement being
sent before the unpacking begins.

Have you simply considered using a separate thread to do the unpacking?

> I slowly started to make peace with the idea that there will be a
> separate script to handle the unpacking/checking/moving and all the
> parameters will be passed as command line arguments using either exec*
> or spawn*. This is not ideal because the nicely structured data in
> classes have to be mapped to a long list of arguments. So if anyone
> has a better idea, I'm still interested.
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list