[Buildbot-devel] Adding a log in a RemoteCommand

Ben Hearsum bhearsum at mozilla.com
Tue Mar 18 20:01:52 UTC 2008


Hi All,

I'm coding my first BuildStep that involves a RemoteCommand. This  
BuildStep is intended to gather some data and set it as build  
properties. Gathering the data is easy -- but I'm not sure how to dump  
it into a log that can be parsed by the master-side BuildStep.

This is what I've tried (these classes are dumbed down a bit for the  
sake of brevity):

class MyStep(LoggingBuildStep):
  def start(self):
   self.addLog('stdout')
   args = {'timeout': 60}
   cmd = LoggedRemoteCommand("myRemoteCommand", args)
   self.startCommand(cmd)

  def evaluateCommand(self, cmd)
   log = cmd.logs['stdio'].getText()
   for property in log.split("\n"):
    name, value = property.split(": ")
    self.setProperty(name, value)


And on the slave-side:
class MyRemoteCommand(Command):
  def start(self):
   log = "Foo: bar\n"
   log += "Foo2: bar2\n"
   log += "Foo3: bar3"

   self.sendStatus({'stdio'}: log})


The BuildStep appears to run fine, but the log is empty. Obviously I'm  
doing this wrong -- but I can't figure out how to do it right. I've  
tried tracing the sendStatus command, which appears to call an  
'update' method on the BuildStep class (which doesn't exist).

Any pointers/tips are welcome (boy I wish I was at Pycon right now...)

- Ben




More information about the devel mailing list