diff options
author | 2015-01-09 10:41:59 -0800 | |
---|---|---|
committer | 2015-01-09 17:57:57 -0800 | |
commit | 94e5ddece6355939764bab6c2142d07b85f246ac (patch) | |
tree | 32bbff9670e6d633b2eabc885453f431c3ebedd4 /tools/run_tests/jobset.py | |
parent | a5cf7bd7e6750ba3d8ed89a22466997adfbf7e6a (diff) |
Only run one make at a time.
If openssl has not been built, running parallel make processes causes some problems.
Change on 2015/01/09 by ctiller <ctiller@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83617340
Diffstat (limited to 'tools/run_tests/jobset.py')
-rwxr-xr-x | tools/run_tests/jobset.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index d3a46b63e1..2ab95ef97c 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -8,7 +8,7 @@ import tempfile import time -_MAX_JOBS = 16 * multiprocessing.cpu_count() +_DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count() def shuffle_iteratable(it): @@ -81,15 +81,16 @@ class Job(object): class Jobset(object): """Manages one run of jobs.""" - def __init__(self, check_cancelled): + def __init__(self, check_cancelled, maxjobs): self._running = set() self._check_cancelled = check_cancelled self._cancelled = False self._failures = 0 + self._maxjobs = maxjobs def start(self, cmdline): """Start a job. Return True on success, False on failure.""" - while len(self._running) >= _MAX_JOBS: + while len(self._running) >= self._maxjobs: if self.cancelled(): return False self.reap() if self.cancelled(): return False @@ -130,10 +131,10 @@ def _never_cancelled(): return False -def run(cmdlines, check_cancelled=_never_cancelled): - js = Jobset(check_cancelled) +def run(cmdlines, check_cancelled=_never_cancelled, maxjobs=None): + js = Jobset(check_cancelled, + maxjobs if maxjobs is not None else _DEFAULT_MAX_JOBS) for cmdline in shuffle_iteratable(cmdlines): if not js.start(cmdline): break return js.finish() - |