Possible to make subprocess.Popen jobs run serially rather than in parallel?

Thomas Jollans thomas at jollans.com
Wed Jun 16 10:13:37 EDT 2010


On 06/16/2010 04:04 PM, Chris Seberino wrote:
> On Jun 15, 2:03 pm, Stephen Hansen <me+list/pyt... at ixokai.io> wrote:
> 
>> Just call "process.wait()" after you call process = subprocess.Popen(...)
> 
> I may have not been clear.....
> I *don't* want web app to block on Popen.wait.
> I *do* want the Popen process to run in the background which web app
> still runs doing other things.
> 
> Rather, I don't want *MANY* Popen processes to run in the
> background....just one preferably.

so create a single extra worker process. Main app spawns or connects to
worker process, worker process takes care of getting the work done,
either by forking and waiting (sounds silly to me...) or by just doing
the work it's asked to so.

How about threads? How about using os.fork instead of subprocess? How
about using the new multiprocessing module?





More information about the Python-list mailing list