Last active
September 18, 2017 13:05
-
-
Save davidgardenier/c04856c1e63674c5fd1ea946d7eaadc6 to your computer and use it in GitHub Desktop.
For Claire
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
template = 'python script.py {0} {1} {2} {3} > file_{0}_{1}_{2}_{3}.txt' | |
args = [[1, 2, 3, 4], [5, 6, 7, 8]] | |
# Run commands in parallel | |
processes = [] | |
for arg in args: | |
command = template.format(*[str(a) for a in arg]) | |
process = subprocess.Popen(command, shell=True) | |
processes.append(process) | |
# Collect statuses | |
output = [p.wait() for p in processes] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment