Package buildbot :: Package process :: Module buildstep :: Class LoggedRemoteCommand
[frames] | no frames]

Class LoggedRemoteCommand

source code

 twisted.spread.jelly.Jellyable --+            
                                  |            
twisted.spread.flavors.Serializable --+        
                                      |        
   twisted.spread.flavors.Referenceable --+    
                                          |    
                              RemoteCommand --+
                                              |
                                             LoggedRemoteCommand
Known Subclasses:

I am a RemoteCommand which gathers output from the remote command into one or more local log files. My self.logs dictionary contains references to these buildbot.status.builder.LogFile instances. Any stdout/stderr/header updates from the slave will be put into self.logs['stdio'], if it exists. If the remote command uses other log files, they will go into other entries in self.logs.

If you want to use stdout or stderr, you should create a LogFile named 'stdio' and pass it to my useLog() message. Otherwise stdout/stderr will be ignored, which is probably not what you want.

Unless you tell me otherwise, when my command completes I will close all the LogFiles that I know about.

Instance Methods
 
__init__(self, *args, **kwargs) source code
 
__repr__(self) source code
 
useLog(self, loog, closeWhenFinished=False, logfileName=None)
Start routing messages from a remote logfile to a local LogFile
source code
 
useLogDelayed(self, logfileName, activateCallBack, closeWhenFinished=False) source code
twisted.internet.defer.Deferred
start(self)
Tell the slave to start executing the remote command.
source code
 
addStdout(self, data) source code
 
addStderr(self, data) source code
 
addHeader(self, data) source code
 
addToLog(self, logname, data) source code
 
remoteUpdate(self, update) source code
 
remoteComplete(self, maybeFailure)
Subclasses can override this.
source code

Inherited from RemoteCommand: interrupt, remote_complete, remote_update, run

Inherited from twisted.spread.flavors.Referenceable: jellyFor, remoteMessageReceived

Inherited from twisted.spread.flavors.Serializable: processUniqueID

Inherited from twisted.spread.jelly.Jellyable: __providedBy__, getStateFor

Class Variables
  rc = None
  debug = False

Inherited from RemoteCommand: commandCounter

Inherited from twisted.spread.flavors.Referenceable: __implemented__, __provides__, perspective

Instance Variables
  logs
maps logname to a LogFile instance

Inherited from RemoteCommand: active

Method Details

__init__(self, *args, **kwargs)
(Constructor)

source code 
Parameters:
  • remote_command - remote command to start. This will be passed to buildbot.slave.bot.SlaveBuilder.remote_startCommand and needs to have been registered slave-side by buildbot.slave.registry.registerSlaveCommand
  • args - arguments to send to the remote command
Overrides: RemoteCommand.__init__
(inherited documentation)

useLog(self, loog, closeWhenFinished=False, logfileName=None)

source code 

Start routing messages from a remote logfile to a local LogFile

I take a local ILogFile instance in 'loog', and arrange to route remote log messages for the logfile named 'logfileName' into it. By default this logfileName comes from the ILogFile itself (using the name by which the ILogFile will be displayed), but the 'logfileName' argument can be used to override this. For example, if logfileName='stdio', this logfile will collect text from the stdout and stderr of the command.

Parameters:
  • loog - an instance which implements ILogFile
  • closeWhenFinished - a boolean, set to False if the logfile will be shared between multiple RemoteCommands. If True, the logfile will be closed when this ShellCommand is done with it.
  • logfileName - a string, which indicates which remote log file should be routed into this ILogFile. This should match one of the keys of the logfiles= argument to ShellCommand.

start(self)

source code 

Tell the slave to start executing the remote command.

Returns: twisted.internet.defer.Deferred
a deferred that will fire when the remote command is done (with None as the result)
Overrides: RemoteCommand.start
(inherited documentation)

remoteUpdate(self, update)

source code 
Overrides: RemoteCommand.remoteUpdate

remoteComplete(self, maybeFailure)

source code 

Subclasses can override this.

This is called when the RemoteCommand has finished. 'maybeFailure' will be None if the command completed normally, or a Failure instance in one of the following situations:

  • the slave was lost before the command was started
  • the slave didn't respond to the startCommand message
  • the slave raised an exception while starting the command (bad command name, bad args, OSError from missing executable)
  • the slave raised an exception while finishing the command (they send back a remote_complete message with a Failure payload)

and also (for now):

  • slave disconnected while the command was running

This method should do cleanup, like closing log files. It should normally return the 'failure' argument, so that any exceptions will be propagated to the Step. If it wants to consume them, return None instead.

Overrides: RemoteCommand.remoteComplete
(inherited documentation)