← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/jobrunner-012 into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/jobrunner-012 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1019215 in Launchpad itself: "InvalidTransition: Transition from Completed to Running is invalid."
  https://bugs.launchpad.net/launchpad/+bug/1019215

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/jobrunner-012/+merge/169344

Add a is_runnable property to Job, and jump to lazr.jobrunner 0.12. This means lazr.jobrunner will check the is_runnable property before running the job through celery.
-- 
https://code.launchpad.net/~stevenk/launchpad/jobrunner-012/+merge/169344
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/jobrunner-012 into lp:launchpad.
=== modified file 'lib/lp/services/job/interfaces/job.py'
--- lib/lp/services/job/interfaces/job.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/job/interfaces/job.py	2013-06-14 06:09:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Interfaces including and related to IJob."""
@@ -107,6 +107,8 @@
         title=_("Whether or not this job's status is such that it "
                 "could eventually complete."))
 
+    is_runnable = Bool(title=_("Whether or not this job is runnable."))
+
     def acquireLease(duration=300):
         """Acquire the lease for this Job, or raise LeaseHeld."""
 

=== modified file 'lib/lp/services/job/model/job.py'
--- lib/lp/services/job/model/job.py	2012-06-14 05:18:22 +0000
+++ lib/lp/services/job/model/job.py	2013-06-14 06:09:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """ORM object representing jobs."""
@@ -124,6 +124,11 @@
         """See `IJob`."""
         return self.status in self.PENDING_STATUSES
 
+    @property
+    def is_runnable(self):
+        """See `IJob`."""
+        return self.status == JobStatus.WAITING
+
     @classmethod
     def createMultiple(self, store, num_jobs, requester=None):
         """Create multiple `Job`s at once.

=== modified file 'versions.cfg'
--- versions.cfg	2013-05-09 23:35:44 +0000
+++ versions.cfg	2013-06-14 06:09:30 +0000
@@ -45,7 +45,7 @@
 lazr.config = 1.1.3
 lazr.delegates = 1.2.0
 lazr.enum = 1.1.3
-lazr.jobrunner = 0.11
+lazr.jobrunner = 0.12
 lazr.lifecycle = 1.1
 lazr.restful = 0.19.10
 lazr.restfulclient = 0.13.2