Skip to content

Instantly share code, notes, and snippets.

@candlerb
Created July 12, 2021 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save candlerb/63596e698b3d7bd6aee0f4125e3f574c to your computer and use it in GitHub Desktop.
Save candlerb/63596e698b3d7bd6aee0f4125e3f574c to your computer and use it in GitHub Desktop.
gf-par.py (run multiple instances of gf-run.py in parallel)
#!/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