Created
July 12, 2021 16:28
-
-
Save candlerb/63596e698b3d7bd6aee0f4125e3f574c to your computer and use it in GitHub Desktop.
gf-par.py (run multiple instances of gf-run.py in parallel)
This file contains hidden or 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
#!/usr/bin/python3 | |
import subprocess, sys | |
COUNT = 36 | |
CONCURRENCY = 12 | |
NUM_DISKS = 46 | |
jobs = [] | |
errors = [] | |
for index in range(COUNT): | |
# Limit concurrency | |
if len(jobs) >= CONCURRENCY: | |
job = jobs.pop(0) | |
rc = job.wait() | |
if rc != 0: | |
errors.append("ERROR: %r: %r" % (rc, job.args)) | |
break | |
print("Generating %d" % index, file=sys.stderr) | |
jobs.append(subprocess.Popen(["./gf-run.py", str(index), str(NUM_DISKS)])) | |
for job in jobs: | |
rc = job.wait() | |
if rc != 0: | |
errors.append("ERROR: %r: %r" % (rc, job.args)) | |
for error in errors: | |
print(error) | |
sys.exit(1 if errors else 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment