[Buildbot-commits] buildbot/buildbot/slave commands.py,1.90,1.91

Brian Warner warner at users.sourceforge.net
Sat Dec 22 08:54:51 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21627/buildbot/slave

Modified Files:
	commands.py 
Log Message:
[project @ commands: don't send more than 128kB per PB message, to avoid its hardwired string-size limit. Closes #129.]

Original author: warner at lothar.com
Date: 2007-12-22 08:53:57+00:00

Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- commands.py	29 Nov 2007 10:05:51 -0000	1.90
+++ commands.py	22 Dec 2007 08:54:49 -0000	1.91
@@ -222,6 +222,7 @@
     notreally = False
     BACKUP_TIMEOUT = 5
     KILL = "KILL"
+    CHUNK_LIMIT = 128*1024
 
     def __init__(self, builder, command,
                  workdir, environ=None,
@@ -413,9 +414,17 @@
             w.start()
 
 
+    def _chunkForSend(self, data):
+        # limit the chunks that we send over PB to 128k, since it has a
+        # hardwired string-size limit of 640k.
+        LIMIT = self.CHUNK_LIMIT
+        for i in range(0, len(data), LIMIT):
+            yield data[i:i+LIMIT]
+
     def addStdout(self, data):
         if self.sendStdout:
-            self.sendStatus({'stdout': data})
+            for chunk in self._chunkForSend(data):
+                self.sendStatus({'stdout': chunk})
         if self.keepStdout:
             self.stdout += data
         if self.timer:
@@ -423,14 +432,16 @@
 
     def addStderr(self, data):
         if self.sendStderr:
-            self.sendStatus({'stderr': data})
+            for chunk in self._chunkForSend(data):
+                self.sendStatus({'stderr': chunk})
         if self.keepStderr:
             self.stderr += data
         if self.timer:
             self.timer.reset(self.timeout)
 
     def addLogfile(self, name, data):
-        self.sendStatus({'log': (name, data)})
+        for chunk in self._chunkForSend(data):
+            self.sendStatus({'log': (name, chunk)})
         if self.timer:
             self.timer.reset(self.timeout)
 





More information about the Commits mailing list