[Buildbot-devel] Adding a log in a RemoteCommand

Ben Hearsum bhearsum at mozilla.com
Wed Mar 19 12:01:20 UTC 2008


For posterity, all I needed to do was sendStatus({'stdout': log}) and  
LoggedRemoteCommand took care of the rest.

- Ben

On 18-Mar-08, at 8:52 PM, Ben Hearsum wrote:

> Thanks Axel, I think you've just solved my problem. I (dumbly) and
> sendStatus()'ing 'stdio', which my brain keeps parsing as 'stdout'. As
> far as I can tell, LoggedRemoteCommand will already handle a 'stdout'
> -- so I'll give that a try tomorrow.
>
> Cheers.
> - Ben
>
> On 18-Mar-08, at 4:16 PM, Axel Hecht wrote:
>
>> Hey Ben,
>>
>> here's how I do it:
>>
>> You can basically sendStatus any pickable object, see lin 76 in
>> http://hg.mozilla.org/users/axel_mozilla.com/tooling/?file/7c47a3380c9f/mozilla/tools/buildbotcustom/buildbotcustom/slave/comparestep.py
>> .
>>
>> On the master step side, you just need to handle that special status,
>> ResultRemoteCommand.remoteUpdate in
>> http://hg.mozilla.org/users/axel_mozilla.com/tooling/?file/7c47a3380c9f/mozilla/tools/buildbotcustom/buildbotcustom/steps/comparestep.py
>>
>> HTH
>>
>> Axel
>>
>> 2008/3/18, Ben Hearsum <bhearsum at mozilla.com>:
>>> 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
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Buildbot-devel mailing list
>>> Buildbot-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel





More information about the devel mailing list