aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/jobset.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/run_tests/jobset.py')
-rwxr-xr-xtools/run_tests/jobset.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index 985b7a7f16..058a30d1ce 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -223,6 +223,7 @@ class Jobset(object):
self._travis = travis
self._cache = cache
self._stop_on_failure = stop_on_failure
+ self._hashes = {}
def start(self, spec):
"""Start a job. Return True on success, False on failure."""
@@ -231,11 +232,15 @@ class Jobset(object):
self.reap()
if self.cancelled(): return False
if spec.hash_targets:
- bin_hash = hashlib.sha1()
- for fn in spec.hash_targets:
- with open(which(fn)) as f:
- bin_hash.update(f.read())
- bin_hash = bin_hash.hexdigest()
+ if spec.identity() in self._hashes:
+ bin_hash = self._hashes[spec.identity()]
+ else:
+ bin_hash = hashlib.sha1()
+ for fn in spec.hash_targets:
+ with open(which(fn)) as f:
+ bin_hash.update(f.read())
+ bin_hash = bin_hash.hexdigest()
+ self._hashes[spec.identity()] = bin_hash
should_run = self._cache.should_run(spec.identity(), bin_hash)
else:
bin_hash = None
@@ -266,6 +271,7 @@ class Jobset(object):
for job in self._running:
job.kill()
dead.add(job)
+ break
for job in dead:
self._completed += 1
self._running.remove(job)