← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/lazr.jobrunner/only-run-if-canrun into lp:lazr.jobrunner

 

Steve Kowalik has proposed merging lp:~stevenk/lazr.jobrunner/only-run-if-canrun into lp:lazr.jobrunner.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/lazr.jobrunner/only-run-if-canrun/+merge/169105

Only run the job if the job reports that it can run -- that will avoid us doing unnecessary work and then logging an OOPS when BranchScanJob attempt to transition from COMPLETED to RUNNING.
-- 
https://code.launchpad.net/~stevenk/lazr.jobrunner/only-run-if-canrun/+merge/169105
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/lazr.jobrunner/only-run-if-canrun into lp:lazr.jobrunner.
=== modified file 'NEWS.txt'
--- NEWS.txt	2012-10-25 14:03:11 +0000
+++ NEWS.txt	2013-06-13 05:25:30 +0000
@@ -1,7 +1,12 @@
 News
 ====
 
+0.12
+----
+* Only run the job if its canRun() method returns True.
+
 0.11
+----
 * Add indirection to user error handling to avoid oopses if the Job is
   security-proxied.
 

=== modified file 'setup.py'
--- setup.py	2012-10-25 14:03:11 +0000
+++ setup.py	2013-06-13 05:25:30 +0000
@@ -22,7 +22,7 @@
 NEWS = open(os.path.join(here, 'NEWS.txt')).read()
 
 
-version = '0.11'
+version = '0.12'
 
 install_requires = [
     # List your project dependencies here.

=== modified file 'src/lazr/jobrunner/celerytask.py'
--- src/lazr/jobrunner/celerytask.py	2012-07-09 10:58:00 +0000
+++ src/lazr/jobrunner/celerytask.py	2013-06-13 05:25:30 +0000
@@ -41,6 +41,8 @@
 
     def run(self, job_id):
         job = self.job_source.get(job_id)
+        if not job.canRun():
+            return None
         try:
             job.acquireLease()
         except LeaseHeld:

=== modified file 'src/lazr/jobrunner/version.txt'
--- src/lazr/jobrunner/version.txt	2012-10-25 14:03:11 +0000
+++ src/lazr/jobrunner/version.txt	2013-06-13 05:25:30 +0000
@@ -1,1 +1,1 @@
-0.11
+0.12