Quantcast
Channel: Java mon amour
Viewing all articles
Browse latest Browse all 1121

Python: run multiple processes in parallel and wait for completion

$
0
0
This code is quite minimalistic but it works really well. It employs a very old API which is compatible with Pythong 2.1 (WLST very old version of Python....)

from sets import Set

processes = Set()

for command in commandlistlist:
print "running", command
processes.add(os.popen(command))

#wait until all processes have completed
for proc in processes:
proc.read()





Viewing all articles
Browse latest Browse all 1121

Trending Articles