[Buildbot-commits] buildbot/buildbot/status/web waterfall.py, 1.26, 1.27
Brian Warner
warner at users.sourceforge.net
Fri Mar 21 04:25:37 UTC 2008
Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20682/buildbot/status/web
Modified Files:
waterfall.py
Log Message:
[project @ waterfall: apply patch from Ted Mielczarek to make ETA display prettier, and make next-build-starts-in use the same format. Closes #95.]
Original author: warner at lothar.com
Date: 2008-03-21 04:24:47+00:00
Index: waterfall.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/waterfall.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- waterfall.py 22 Nov 2007 00:20:12 -0000 1.26
+++ waterfall.py 21 Mar 2008 04:25:35 -0000 1.27
@@ -20,13 +20,22 @@
# this provides the "current activity" box, just above the builder name
implements(ICurrentBox)
- def formatETA(self, eta):
+ def formatETA(self, prefix, eta):
if eta is None:
return []
if eta < 0:
return ["Soon"]
+ eta_parts = []
+ eta_secs = eta
+ if eta_secs > 3600:
+ eta_parts.append("%d hrs" % (eta_secs / 3600))
+ eta_secs %= 3600
+ if eta_secs > 60:
+ eta_parts.append("%d mins" % (eta_secs / 60))
+ eta_secs %= 60
+ eta_parts.append("%d secs" % eta_secs)
abstime = time.strftime("%H:%M:%S", time.localtime(util.now()+eta))
- return ["ETA in", "%d secs" % eta, "at %s" % abstime]
+ return [prefix, ", ".join(eta_parts), "at %s" % abstime]
def getBox(self, status):
# getState() returns offline, idle, or building
@@ -51,8 +60,7 @@
if builds:
for b in builds:
eta = b.getETA()
- if eta:
- text.extend(self.formatETA(eta))
+ text.extend(self.formatETA("ETA in", eta))
elif state == "offline":
color = "red"
text = ["offline"]
@@ -77,16 +85,8 @@
if pbs:
text.append("%d pending" % len(pbs))
for t in upcoming:
- text.extend(["next at",
- time.strftime("%H:%M:%S", time.localtime(t)),
- "[%d secs]" % (t - util.now()),
- ])
- # TODO: the upcoming-builds box looks like:
- # ['waiting', 'next at', '22:14:15', '[86 secs]']
- # while the currently-building box is reversed:
- # ['building', 'ETA in', '2 secs', 'at 22:12:50']
- # consider swapping one of these to make them look the same. also
- # consider leaving them reversed to make them look different.
+ eta = t - util.now()
+ text.extend(self.formatETA("next in", eta))
return Box(text, color=color, class_="Activity " + state)
components.registerAdapter(CurrentBox, builder.BuilderStatus, ICurrentBox)
More information about the Commits
mailing list