← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/buildd-new-status into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/buildd-new-status into lp:launchpad.

Commit message:
Go back to using the status method on buildd slaves, now that it's a synonym for status_dict.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/buildd-new-status/+merge/204508

Now that all buildd slaves are on launchpad-buildd 121, we can take the next step of the plan I outlined in https://code.launchpad.net/~cjwatson/launchpad-buildd/better-status/+merge/189675, and switch the master back to using the status method but now with dict semantics.
-- 
https://code.launchpad.net/~cjwatson/launchpad/buildd-new-status/+merge/204508
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/buildd-new-status into lp:launchpad.
=== modified file 'lib/lp/buildmaster/interactor.py'
--- lib/lp/buildmaster/interactor.py	2014-01-30 15:04:06 +0000
+++ lib/lp/buildmaster/interactor.py	2014-02-03 14:56:34 +0000
@@ -108,9 +108,9 @@
         """Return the protocol version and the builder methods supported."""
         return self._with_timeout(self._server.callRemote('info'))
 
-    def status_dict(self):
+    def status(self):
         """Return the status of the build daemon."""
-        return self._with_timeout(self._server.callRemote('status_dict'))
+        return self._with_timeout(self._server.callRemote('status'))
 
     def ensurepresent(self, sha1sum, url, username, password):
         """Attempt to ensure the given file is present."""
@@ -429,7 +429,7 @@
     def extractBuildStatus(slave_status):
         """Read build status name.
 
-        :param slave_status: build status dict from BuilderSlave.status_dict.
+        :param slave_status: build status dict from BuilderSlave.status.
         :return: the unqualified status name, e.g. "OK".
         """
         status_string = slave_status['build_status']

=== modified file 'lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py'
--- lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py	2014-01-30 15:04:06 +0000
+++ lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py	2014-02-03 14:56:34 +0000
@@ -41,10 +41,10 @@
     def getBuildCookie():
         """Return a string which uniquely identifies the job."""
 
-    def handleStatus(bq, status, status_dict):
+    def handleStatus(bq, status, slave_status):
         """Update the build from a WAITING slave result.
 
         :param bq: The `BuildQueue` currently being processed.
         :param status: The tail of the BuildStatus (eg. OK or PACKAGEFAIL).
-        :param status_dict: Slave status dict from `BuilderSlave.status_dict`.
+        :param slave_status: Slave status dict from `BuilderSlave.status`.
         """

=== modified file 'lib/lp/buildmaster/manager.py'
--- lib/lp/buildmaster/manager.py	2014-01-30 15:04:06 +0000
+++ lib/lp/buildmaster/manager.py	2014-02-03 14:56:34 +0000
@@ -415,7 +415,7 @@
         slave = self.slave_factory(vitals)
         if vitals.builderok:
             self.logger.debug("Scanning %s." % self.builder_name)
-            slave_status = yield slave.status_dict()
+            slave_status = yield slave.status()
         else:
             slave_status = None
 

=== modified file 'lib/lp/buildmaster/tests/mock_slaves.py'
--- lib/lp/buildmaster/tests/mock_slaves.py	2014-01-30 15:04:06 +0000
+++ lib/lp/buildmaster/tests/mock_slaves.py	2014-02-03 14:56:34 +0000
@@ -76,7 +76,7 @@
         self.arch_tag = arch_tag
         self.version = version
 
-    def status_dict(self):
+    def status(self):
         slave_status = {'builder_status': 'BuilderStatus.IDLE'}
         if self.version is not None:
             slave_status['builder_version'] = self.version
@@ -139,8 +139,8 @@
         super(BuildingSlave, self).__init__()
         self.build_id = build_id
 
-    def status_dict(self):
-        self.call_log.append('status_dict')
+    def status(self):
+        self.call_log.append('status')
         buildlog = xmlrpclib.Binary("This is a build log")
         return defer.succeed({
             'builder_status': 'BuilderStatus.BUILDING',
@@ -176,8 +176,8 @@
         # can update this list as needed.
         self.valid_file_hashes = ['buildlog']
 
-    def status_dict(self):
-        self.call_log.append('status_dict')
+    def status(self):
+        self.call_log.append('status')
         return defer.succeed({
             'builder_status': 'BuilderStatus.WAITING',
             'build_status': self.state,
@@ -200,8 +200,8 @@
 class AbortingSlave(OkSlave):
     """A mock slave that looks like it's in the process of aborting."""
 
-    def status_dict(self):
-        self.call_log.append('status_dict')
+    def status(self):
+        self.call_log.append('status')
         return defer.succeed({
             'builder_status': 'BuilderStatus.ABORTING',
             'build_id': '1-1',
@@ -217,8 +217,8 @@
     def __init__(self):
         self.call_log = []
 
-    def status_dict(self):
-        self.call_log.append('status_dict')
+    def status(self):
+        self.call_log.append('status')
         return defer.succeed({
             'builder_status': 'BuilderStatus.BUILDING',
             'build_id': '1000-10000',
@@ -239,8 +239,8 @@
     def __init__(self):
         self.call_log = []
 
-    def status_dict(self):
-        self.call_log.append('status_dict')
+    def status(self):
+        self.call_log.append('status')
         return defer.fail(xmlrpclib.Fault(8001, "Broken slave"))
 
 

=== modified file 'lib/lp/buildmaster/tests/test_interactor.py'
--- lib/lp/buildmaster/tests/test_interactor.py	2014-01-30 15:04:06 +0000
+++ lib/lp/buildmaster/tests/test_interactor.py	2014-02-03 14:56:34 +0000
@@ -155,7 +155,7 @@
         # A slave that's 'lost' should be aborted; when the slave is
         # broken then abort() should also throw a fault.
         slave = LostBuildingBrokenSlave()
-        slave_status = yield slave.status_dict()
+        slave_status = yield slave.status()
         try:
             yield BuilderInteractor.rescueIfLost(
                 extract_vitals_from_db(MockBuilder()), slave, slave_status,
@@ -171,7 +171,7 @@
         # idle. SlaveScanner.scan() will clean up the DB side, because
         # we still report that it's lost.
         slave = OkSlave()
-        slave_status = yield slave.status_dict()
+        slave_status = yield slave.status()
         lost = yield BuilderInteractor.rescueIfLost(
             extract_vitals_from_db(MockBuilder()), slave, slave_status,
             'trivial')
@@ -182,7 +182,7 @@
     def test_recover_ok_slave(self):
         # An idle slave that's meant to be idle is not rescued.
         slave = OkSlave()
-        slave_status = yield slave.status_dict()
+        slave_status = yield slave.status()
         lost = yield BuilderInteractor.rescueIfLost(
             extract_vitals_from_db(MockBuilder()), slave, slave_status, None)
         self.assertFalse(lost)
@@ -193,12 +193,12 @@
         # rescueIfLost does not attempt to abort or clean a builder that is
         # WAITING.
         waiting_slave = WaitingSlave(build_id='trivial')
-        slave_status = yield waiting_slave.status_dict()
+        slave_status = yield waiting_slave.status()
         lost = yield BuilderInteractor.rescueIfLost(
             extract_vitals_from_db(MockBuilder()), waiting_slave, slave_status,
             'trivial')
         self.assertFalse(lost)
-        self.assertEqual(['status_dict'], waiting_slave.call_log)
+        self.assertEqual(['status'], waiting_slave.call_log)
 
     @defer.inlineCallbacks
     def test_recover_waiting_slave_with_bad_id(self):
@@ -208,40 +208,40 @@
         # builder is reset for a new build, and the corrupt build is
         # discarded.
         waiting_slave = WaitingSlave(build_id='non-trivial')
-        slave_status = yield waiting_slave.status_dict()
+        slave_status = yield waiting_slave.status()
         lost = yield BuilderInteractor.rescueIfLost(
             extract_vitals_from_db(MockBuilder()), waiting_slave, slave_status,
             'trivial')
         self.assertTrue(lost)
-        self.assertEqual(['status_dict', 'clean'], waiting_slave.call_log)
+        self.assertEqual(['status', 'clean'], waiting_slave.call_log)
 
     @defer.inlineCallbacks
     def test_recover_building_slave_with_good_id(self):
         # rescueIfLost does not attempt to abort or clean a builder that is
         # BUILDING.
         building_slave = BuildingSlave(build_id='trivial')
-        slave_status = yield building_slave.status_dict()
+        slave_status = yield building_slave.status()
         lost = yield BuilderInteractor.rescueIfLost(
             extract_vitals_from_db(MockBuilder()), building_slave,
             slave_status, 'trivial')
         self.assertFalse(lost)
-        self.assertEqual(['status_dict'], building_slave.call_log)
+        self.assertEqual(['status'], building_slave.call_log)
 
     @defer.inlineCallbacks
     def test_recover_building_slave_with_bad_id(self):
         # If a slave is BUILDING with a build id we don't recognize, then we
         # abort the build, thus stopping it in its tracks.
         building_slave = BuildingSlave(build_id='non-trivial')
-        slave_status = yield building_slave.status_dict()
+        slave_status = yield building_slave.status()
         lost = yield BuilderInteractor.rescueIfLost(
             extract_vitals_from_db(MockBuilder()), building_slave,
             slave_status, 'trivial')
         self.assertTrue(lost)
-        self.assertEqual(['status_dict', 'abort'], building_slave.call_log)
+        self.assertEqual(['status', 'abort'], building_slave.call_log)
 
 
 class TestBuilderSlaveStatus(TestCase):
-    # Verify what BuilderSlave.status_dict returns with slaves in different
+    # Verify what BuilderSlave.status returns with slaves in different
     # states.
 
     run_tests_with = AsynchronousDeferredRunTest
@@ -250,7 +250,7 @@
     def assertStatus(self, slave, builder_status=None, build_status=None,
                      build_id=False, logtail=False, filemap=None,
                      dependencies=None):
-        status = yield slave.status_dict()
+        status = yield slave.status()
 
         expected = {}
         if builder_status is not None:
@@ -460,21 +460,21 @@
 
     @defer.inlineCallbacks
     def test_initial_status(self):
-        # Calling 'status_dict' returns the current status of the slave. The
+        # Calling 'status' returns the current status of the slave. The
         # initial status is IDLE.
         self.slave_helper.getServerSlave()
         slave = self.slave_helper.getClientSlave()
-        status = yield slave.status_dict()
+        status = yield slave.status()
         self.assertEqual(BuilderStatus.IDLE, status['builder_status'])
 
     @defer.inlineCallbacks
     def test_status_after_build(self):
-        # Calling 'status_dict' returns the current status of the slave.
-        # After a build has been triggered, the status is BUILDING.
+        # Calling 'status' returns the current status of the slave.  After a
+        # build has been triggered, the status is BUILDING.
         slave = self.slave_helper.getClientSlave()
         build_id = 'status-build-id'
         yield self.slave_helper.triggerGoodBuild(slave, build_id)
-        status = yield slave.status_dict()
+        status = yield slave.status()
         self.assertEqual(BuilderStatus.BUILDING, status['builder_status'])
         self.assertEqual(build_id, status['build_id'])
         self.assertIsInstance(status['logtail'], xmlrpclib.Binary)
@@ -624,7 +624,7 @@
         return self.assertCancelled(self.slave.info())
 
     def test_timeout_status(self):
-        return self.assertCancelled(self.slave.status_dict())
+        return self.assertCancelled(self.slave.status())
 
     def test_timeout_ensurepresent(self):
         return self.assertCancelled(

=== modified file 'lib/lp/buildmaster/tests/test_manager.py'
--- lib/lp/buildmaster/tests/test_manager.py	2014-01-30 15:04:06 +0000
+++ lib/lp/buildmaster/tests/test_manager.py	2014-02-03 14:56:34 +0000
@@ -675,7 +675,7 @@
             behaviour_factory=FakeMethod(TrivialBehaviour()))
 
         yield scanner.scan()
-        self.assertEqual(['status_dict'], slave.call_log)
+        self.assertEqual(['status'], slave.call_log)
         self.assertEqual(1, interactor.updateBuild.call_count)
         self.assertEqual(0, bq.reset.call_count)
 
@@ -696,11 +696,11 @@
             slave_factory=FakeMethod(slave),
             behaviour_factory=FakeMethod(TrivialBehaviour()))
 
-        # A single scan will call status_dict(), notice that the slave is
-        # lost, abort() the slave, then reset() the job without calling
+        # A single scan will call status(), notice that the slave is lost,
+        # abort() the slave, then reset() the job without calling
         # updateBuild().
         yield scanner.scan()
-        self.assertEqual(['status_dict', 'abort'], slave.call_log)
+        self.assertEqual(['status', 'abort'], slave.call_log)
         self.assertEqual(0, interactor.updateBuild.call_count)
         self.assertEqual(1, bq.reset.call_count)
 
@@ -720,11 +720,11 @@
             slave_factory=FakeMethod(slave),
             behaviour_factory=FakeMethod(None))
 
-        # A single scan will call status_dict(), notice that the slave is
-        # lost, abort() the slave, then reset() the job without calling
+        # A single scan will call status(), notice that the slave is lost,
+        # abort() the slave, then reset() the job without calling
         # updateBuild().
         yield scanner.scan()
-        self.assertEqual(['status_dict', 'abort'], slave.call_log)
+        self.assertEqual(['status', 'abort'], slave.call_log)
         self.assertEqual(0, interactor.updateBuild.call_count)
 
     def test_getExpectedCookie_caches(self):

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py'
--- lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py	2014-01-30 15:04:06 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py	2014-02-03 14:56:34 +0000
@@ -338,7 +338,7 @@
     @defer.inlineCallbacks
     def updateBuild(self, candidate, slave):
         bf = MockBuilderFactory(self.builder, candidate)
-        slave_status = yield slave.status_dict()
+        slave_status = yield slave.status()
         yield self.interactor.updateBuild(
             bf.getVitals('foo'), slave, slave_status, bf,
             self.interactor.getBuildBehaviour)

=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py'
--- lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py	2014-01-30 15:04:06 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py	2014-02-03 14:56:34 +0000
@@ -183,7 +183,7 @@
             self.assertNotIn('clean', slave_call_log)
             self.assertEqual(0, behaviour._uploadTarball.call_count)
 
-            return slave.status_dict()
+            return slave.status()
 
         def got_status(status):
             return (
@@ -216,7 +216,7 @@
 
         def got_dispatch((status, info)):
             # Now that we've dispatched, get the status.
-            return slave.status_dict()
+            return slave.status()
 
         def got_status(status):
             del status['filemap']
@@ -248,7 +248,7 @@
         d = behaviour.dispatchBuildToSlave(queue_item, logging)
 
         def got_dispatch((status, info)):
-            return slave.status_dict()
+            return slave.status()
 
         def got_status(status):
             del status['filemap']
@@ -287,7 +287,7 @@
 
         def got_dispatch((status, info)):
             slave.getFile = fake_getFile
-            return slave.status_dict()
+            return slave.status()
 
         def got_status(status):
             return behaviour.handleStatus(


Follow ups