[Buildbot-devel] Detect termination of shellcommand due to timeout

Marco listaddr at gmail.com
Sun Oct 16 14:37:46 UTC 2011

2011/10/16 Dustin J. Mitchell <dustin at v.igoro.us>:
> On Sun, Oct 16, 2011 at 6:06 AM, Marco <listaddr at gmail.com> wrote:
>> Thanks. Do you have any pointer to some skeleton/example code?
> Only the parent class and other subclasses in that file; also, the
> developer's manual contains some good information on writing
> buildsteps.

Thanks, after a bit of messing around I came up with this:

from buildbot.status.results import SUCCESS, WARNINGS, FAILURE

class ShellCommandWithTimeout(ShellCommand):

   def evaluateCommand(self, cmd):

      if cmd.rc == -1:
        self.setProperty(self.name + "-timeout", 1, self.name + "-step")

      # standard evaluateCommand copied from parent

      if self.log_eval_func:
        return self.log_eval_func(cmd, self.step_status)
      if cmd.rc != 0:
        return FAILURE
      return SUCCESS

I declare my steps as ShellCommandwithTimeout objects (well, those I'm
interested to know whether they timed out), and at the end of the
build I can check whether
build.getProperties().hasProperty('somestepname-timeout') and act
It seems to work after some tests.

Does that make sense? Specifically, beside style matters, is there
more that can be checked in addition to cmd.rc being -1? Thanks.

More information about the devel mailing list