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

Class RemoteCommand

source code

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

I represent a single command to be run on the slave. I handle the details of reliably gathering status updates from the slave (acknowledging each), and (eventually, in a future release) recovering from interrupted builds. This is the master-side object that is known to the slave-side buildbot.slave.bot.SlaveBuilder, to which status updates are sent.

My command should be started by calling .run(), which returns a Deferred that will fire when the command has finished, or will errback if an exception is raised.

Typically __init__ or run() will set up self.remote_command to be a string which corresponds to one of the SlaveCommands registered in the buildslave, and self.args to a dictionary of arguments that will be passed to the SlaveCommand instance.

start, remoteUpdate, and remoteComplete are available to be overridden

Instance Methods
 
__init__(self, remote_command, args) source code
 
run(self, step, remote) source code
twisted.internet.defer.Deferred
start(self)
Tell the slave to start executing the remote command.
source code
 
interrupt(self, why) source code
 
remote_update(self, updates)
I am called by the slave's buildbot.slave.bot.SlaveBuilder so I can receive updates from the running remote command.
source code
 
remoteUpdate(self, update) source code
None
remote_complete(self, failure=None)
Called by the slave's buildbot.slave.bot.SlaveBuilder to notify me the remote command has finished.
source code
 
remoteComplete(self, maybeFailure)
Subclasses can override this.
source code

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
list of one int commandCounter = [0]
provides a unique value for each RemoteCommand executed across all slaves

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

Instance Variables
boolean active = False
whether the command is currently running
Method Details

__init__(self, remote_command, args)
(Constructor)

source code 
Parameters:
  • remote_command (string) - 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 (dict) - arguments to send to the remote command

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)

remote_update(self, updates)

source code 

I am called by the slave's buildbot.slave.bot.SlaveBuilder so I can receive updates from the running remote command.

Parameters:
  • updates (list of [object, int]) - list of updates from the remote command

remote_complete(self, failure=None)

source code 

Called by the slave's buildbot.slave.bot.SlaveBuilder to notify me the remote command has finished.

Parameters:
  • failure (twisted.python.failure.Failure or None)
Returns: None

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.