[Buildbot-devel] Reporting Extra Information
Brian Warner
warner-buildbot at lothar.com
Tue Oct 3 18:30:46 UTC 2006
> > start, end = b.getTimes()
> > if start and end: # only show time if the step has actually finished
> > text += "%d secs" % (end - start)
>
> Works great!
>
> Only one problem: This gives me how long the _build_ took (note that it's a
> 'getBuild()' method above :) ), rather than how long each of the steps
> took. Suggestions?
Oops, you're right, I'm getting my Builds and my BuildSteps mixed up. Ignore
what I said before, try this instead:
In StepBox.getBox(), which is where the text for the per-Step boxes is
generated, the 'self.original' attribute is an object which implements
IBuildStepStatus. (self.original.getBuild() returns something that implements
IBuildStatus, which is of course the overall build, not this particular
step).
IBuildStepStatus has a getTimes() method which returns (start,end), as
specified in buildbot/interfaces.py:
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."""
(IBuildStatus also has a getTimes() method with the same specification, but
which indicates the time taken by the overall build).
So you could do something like this inside StepBox.getBox():
step = self.original
start, end = step.getTimes()
if start and end: # only show time if the step has actually finished
text += "%d secs" % (end - start)
Sorry for the confusion :).
-Brian
More information about the devel
mailing list