[Buildbot-devel] Reporting Extra Information

Brian Warner warner-buildbot at lothar.com
Sat Sep 30 22:14:02 UTC 2006


> I'd like the build steps in the waterfall display to show how long they
> took.  Any suggestions as to how I would go about accomplishing this?

I'd patch buildbot/status/html.py, in StepBox.getBox(), which is where the
text for the per-Step boxes is generated.

    def getBox(self):
        b = self.original.getBuild()
        ...

That 'b' object provides all the methods described in
buildbot.interfaces.IBuildStepStatus . (I would point at the epydoc-generated
API reference page here, but it seems to be pretty empty.. I should figure
out how to fix that). One of those methods is getTimes(), described here:

    def getTimes():
        """Returns a tuple of (start, end). 'start' and 'end' are the times
        (seconds since the epoch) when the Step started and finished. If the
        step has not yet started, 'start' will be None. If the step is still
        running, 'end' will be None."""

So you could do something like:

        start, end = b.getTimes()
        if start and end: # only show time if the step has actually finished
            text += "%d secs" % (end - start)

There is also some code sitting around html.py to convert a number of seconds
into something like "3m05s", which might be more readable if your steps tend
to take more than a minute or two.


cheers,
 -Brian




More information about the devel mailing list