[Buildbot-commits] buildbot/buildbot/process step_twisted.py,1.63,1.64 step.py,1.58,1.59 builder.py,1.20,1.21

Brian Warner warner at users.sourceforge.net
Thu Dec 9 10:24:58 UTC 2004


Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18091/buildbot/process

Modified Files:
	step_twisted.py step.py builder.py 
Log Message:
* buildbot/process/step_twisted.py (Trial._commandComplete):
update self.cmd when we start the 'cat test.log' transfer. Without
this, we cannot interrupt the correct RemoteCommand when we lose
the connection.

* buildbot/process/step.py (RemoteCommand.interrupt): don't bother
trying to tell the slave to stop the command if we're already
inactive, or if we no longer have a .remote

* buildbot/process/builder.py (Builder._detached): don't let an
exception in currentBuild.stopBuild() prevent the builder from
being marked offline


Index: builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/builder.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- builder.py	6 Dec 2004 07:36:33 -0000	1.20
+++ builder.py	9 Dec 2004 10:24:56 -0000	1.21
@@ -183,7 +183,11 @@
         if self.currentBuild:
             log.msg("%s._detached: killing build" % self)
             # wasn't enough
-            self.currentBuild.stopBuild("slave lost")
+            try:
+                self.currentBuild.stopBuild("slave lost")
+            except:
+                log.msg("currentBuild.stopBuild failed")
+                log.err()
             self.currentBuild = None
             # TODO: should failover to a new Build
         self.builder_status.addPointEvent(['disconnect'])

Index: step.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- step.py	8 Dec 2004 03:54:56 -0000	1.58
+++ step.py	9 Dec 2004 10:24:56 -0000	1.59
@@ -82,18 +82,38 @@
         return d
 
     def interrupt(self, why):
+        # TODO: consider separating this into interrupt() and stop(), where
+        # stop() unconditionally calls _finished, but interrupt() merely
+        # asks politely for the command to stop soon.
+
+        log.msg("RemoteCommand.interrupt", self, why)
+        if not self.active:
+            log.msg(" but this RemoteCommand is already inactive")
+            return
+        if not self.remote:
+            log.msg(" but our .remote went away")
+            return
         if isinstance(why, Failure) and why.check(error.ConnectionLost):
-            log.msg("RemoteCommand.disconnect: lost slave", self)
+            log.msg("RemoteCommand.disconnect: lost slave")
             self.remote = None
-            self._finished(Failure(error.ConnectionLost()))
+            self._finished(why)
             return
 
         # tell the remote command to halt. Returns a Deferred that will fire
         # when the interrupt command has been delivered.
+        
         d = defer.maybeDeferred(self.remote.callRemote, "interruptCommand",
                                 self.commandID, str(why))
+        # the slave may not have remote_interruptCommand
+        d.addErrback(self._interruptFailed)
         return d
 
+    def _interruptFailed(self, why):
+        log.msg("RemoteCommand._interruptFailed", self)
+        # TODO: forcibly stop the Command now, since we can't stop it
+        # cleanly
+        return None
+
     def remote_update(self, updates):
         max_updatenum = 0
         for (update, num) in updates:

Index: step_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step_twisted.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- step_twisted.py	23 Nov 2004 01:13:54 -0000	1.63
+++ step_twisted.py	9 Dec 2004 10:24:56 -0000	1.64
@@ -373,6 +373,7 @@
         c2 = step.RemoteShellCommand(command=catcmd,
                                      workdir=self.workdir,
                                      )
+        self.cmd = c2
         loog = self.addLog("test.log")
         c2.useLog(loog, True)
         d = c2.run(self, self.remote)





More information about the Commits mailing list