Hi,
I have a "master" process that needs to spawn some child processes.
How can I manage these child processes? (for example, restart if the process is dead)
Thanks!
Hi,
I have a "master" process that needs to spawn some child processes.
How can I manage these child processes? (for example, restart if the process is dead)
Thanks!
If you use the multiprocessing package, every child process has is_alive
method you can check. So one option to to hold a list of all running processes and periodically check is_alive
and re-spawn dead processes.
If you're on POSIX system, you can also catch SIGCHLD (using signal
) and get notified when a child process dies.
This will help http://docs.python.org/library/multiprocessing.html
edit : a good tutorial http://www.ibm.com/developerworks/aix/library/au-multiprocessing/