summaryrefslogtreecommitdiff
path: root/distbuild
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-06-04 10:20:52 (GMT)
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-06-04 13:42:07 (GMT)
commit8fe88b78e3d8b3462a3a27a49e4e72456d71f9ad (patch)
treee07b165456434e43939f74611716cc52cd57a194 /distbuild
parentb9e6fad1b63db722fd5413931667542c202e5800 (diff)
downloadmorph-8fe88b78e3d8b3462a3a27a49e4e72456d71f9ad.tar.gz
Move presence check for job into remove function
We always want to warn if we attempt to remove a job that's not present
Diffstat (limited to 'distbuild')
-rw-r--r--distbuild/worker_build_scheduler.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/distbuild/worker_build_scheduler.py b/distbuild/worker_build_scheduler.py
index 8caf551..57cc022 100644
--- a/distbuild/worker_build_scheduler.py
+++ b/distbuild/worker_build_scheduler.py
@@ -120,18 +120,18 @@ class Jobs(object):
return job
def remove(self, job):
- del self._jobs[job.artifact.basename()]
+ if job.artifact.basename() in self._jobs:
+ del self._jobs[job.artifact.basename()]
+ else:
+ logging.warning("Tried to remove a job that doesn't exist "
+ "(%s)", job.artifact.basename())
def get_jobs(self):
return self._jobs
def remove_jobs(self, jobs):
for job in jobs:
- if job.artifact.basename() in self._jobs:
- self.remove(job)
- else:
- logging.warning("Tried to remove a job that doesn't exist "
- "(%s)", job.artifact.basename())
+ self.remove(job)
def exists(self, artifact_basename):
return artifact_basename in self._jobs