osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiprocessing vs subprocess


Re: " My understanding (so far) is that the tradeoff of using multiprocessing is that my manager script can not exit until all the work processes it starts finish. If one of the worker scripts locks up, this could be problematic. Is there a way to use multiprocessing where processes are launched independent of the parent (manager) process?"

I just want to point out that subprocess (which uses the operating system to start another processes, to run whatever you say - doesn't have to be Python running another script, can be an .exe)  does not have that restriction.  The subprocess call can be blocking (the caller waits), or not.   If not the caller can do whatever it wants including decide not to wait forever, and it can even exit.  

Of course, if one of the processes you launched is locked up that is a problem all by itself, even thought the manager can exit.

--- Joseph S.