Mozilla BuildBot Trending/Patches

From CDOT Wiki
Revision as of 12:31, 7 February 2009 by John64 (talk | contribs)
Jump to: navigation, search

First attempt at timestamps

This patch can be applied to buildbot-0.7.9 to enable build-logs to use the format

1233811875.619101 | 'local-slave' | local-osx | 41 | pulling from http://hg.mozilla.org/mozilla-central/

1233811875.9946001 | 'local-slave' | local-osx | 41 | searching for changes

1233811878.362067 | 'local-slave' | local-osx | 41 | adding changesets

1233811878.373631 | 'local-slave' | local-osx | 41 | adding manifests

1233811878.7630169 | 'local-slave' | local-osx | 41 | adding file changes

1233811881.238174 | 'local-slave' | local-osx | 41 | added 2 changesets with 4 changes to 4 files

The format is unixtime | build slave name | builder name | build number | output
The patch is applied against http://downloads.sourceforge.net/buildbot/buildbot-0.7.9.tar.gz
File:Timestamp.patch.zip

diff -r a9c16958d5dc buildbot/buildbot/status/builder.py
--- a/buildbot/buildbot/status/builder.py	Thu Feb 05 00:37:33 2009 -0500
+++ b/buildbot/buildbot/status/builder.py	Thu Feb 05 00:39:45 2009 -0500
@@ -393,9 +393,9 @@
         self.length += len(text)
 
     def addStdout(self, text):
-        self.addEntry(STDOUT, text)
+        self.addEntry(STDOUT, repr(time()) + ' | ' + repr(self.getStep().build.slavename) + ' | ' + self.getStep().build.getBuilder().getName() + ' | ' + repr(self.getStep().build.getNumber()) + ' | ' + text + '\n')
     def addStderr(self, text):
-        self.addEntry(STDERR, text)
+        self.addEntry(STDERR, repr(time()) + ' | ' + repr(self.getStep().build.slavename) + ' | ' + self.getStep().build.getBuilder().getName() + ' | ' + repr(self.getStep().build.getNumber()) + ' | ' + text + '\n')
     def addHeader(self, text):
         self.addEntry(HEADER, text)
 

New Timestamps Patch

This patch, applied to the previous patch changes the behaviour of the timestamps. Instead of having all information on ever line it only puts a timestamp on each line. Information that is constant throughout the run are only inserted once


diff -r 9a6c6b742a5a buildbot/buildbot/status/builder.py
--- a/buildbot/buildbot/status/builder.py	Sat Feb 07 12:22:37 2009 -0500
+++ b/buildbot/buildbot/status/builder.py	Sat Feb 07 12:27:49 2009 -0500
@@ -6,6 +6,8 @@
 from twisted.internet import reactor, defer
 from twisted.protocols import basic
 from buildbot.process.properties import Properties
+# JOHNFORD
+from time import time
 
 import os, shutil, sys, re, urllib, itertools
 from cPickle import load, dump
@@ -232,6 +234,12 @@
         self.runEntries = []
         self.watchers = []
         self.finishedWatchers = []
+        # Add some information about the build to the log
+        self.addEntry(STDOUT, repr(time()) + ' | '
+                      + repr(self.getStep().build.slavename) + ' | ' 
+                      + self.getStep().build.getBuilder().getName() + ' | ' 
+                      + repr(self.getStep().build.getNumber()))# + ' | ' 
+                      #+ repr(getFilename()))
 
     def getFilename(self):
         return os.path.join(self.step.build.builder.basedir, self.filename)
@@ -391,11 +399,11 @@
         for w in self.watchers:
             w.logChunk(self.step.build, self.step, self, channel, text)
         self.length += len(text)
-
+    
     def addStdout(self, text):
-        self.addEntry(STDOUT, repr(time()) + ' | ' + repr(self.getStep().build.slavename) + ' | ' + self.getStep().build.getBuilder().getName() + ' | ' + repr(self.getStep().build.getNumber()) + ' | ' + text + '\n')
+        self.addEntry(STDOUT, repr(time()) + ' | ' + text)
     def addStderr(self, text):
-        self.addEntry(STDERR, repr(time()) + ' | ' + repr(self.getStep().build.slavename) + ' | ' + self.getStep().build.getBuilder().getName() + ' | ' + repr(self.getStep().build.getNumber()) + ' | ' + text + '\n')
+        self.addEntry(STDERR, repr(time()) + ' | ' + text)
     def addHeader(self, text):
         self.addEntry(HEADER, text)