changeset 284:ddc93fe34cad

Fix a bug in the build master (introduced in [289]) where multiple slaves matching the same target platform would potentially start the same build. This is done by setting the build to `IN_PROGRESS` as soon as the build initiation is sent, as opposed to when the slave accepts the build request.
author cmlenz
date Fri, 14 Oct 2005 21:12:45 +0000
parents 3950b8141e85
children 4fabcaf75787
files bitten/master.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/master.py
+++ b/bitten/master.py
@@ -147,7 +147,13 @@
     def send_initiation(self, queue, build):
         log.info('Initiating build of "%s" on slave %s', build.config,
                  self.name)
+
+        build.slave = self.name
+        build.slave_info.update(self.info)
+        build.status = Build.IN_PROGRESS
+        build.update()
         self.building = True
+
         config = BuildConfig.fetch(queue.env, build.config)
 
         def handle_reply(cmd, msgno, ansno, payload):
@@ -159,6 +165,7 @@
                                     self.name, elem.gettext(),
                                     int(elem.attr['code']))
                 self.building = False
+                self._build_aborted(queue, build)
                 return
 
             elem = xmlio.parse(payload.body)
@@ -212,6 +219,7 @@
                                 self.name, elem.gettext(),
                                 int(elem.attr['code']))
                 self.building = False
+                self._build_aborted(queue, build)
 
             elif cmd == 'ANS':
                 if payload.content_type != beep.BEEP_XML:
@@ -239,12 +247,9 @@
         self.channel.send_msg(message, handle_reply=handle_reply)
 
     def _build_started(self, queue, build, elem, timestamp_delta=None):
-        build.slave = self.name
-        build.slave_info.update(self.info)
         build.started = int(_parse_iso_datetime(elem.attr['time']))
         if timestamp_delta:
             build.started -= timestamp_delta
-        build.status = Build.IN_PROGRESS
         build.update()
 
         log.info('Slave %s started build %d ("%s" as of [%s])',
Copyright (C) 2012-2017 Edgewall Software