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

Class RemoteCommand

Jellyable --+        
            |        
 Serializable --+    
                |    
    Referenceable --+
                    |
                   RemoteCommand

Known Subclasses:
LoggedRemoteCommand, StatusRemoteCommand

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
Method Summary
  __init__(self, remote_command, args)
  __getstate__(self)
  interrupt(self, why)
None remote_complete(self, failure)
Called by the slave's buildbot.slave.bot.SlaveBuilder to notify me the remote command has finished.
  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.
  remoteComplete(self, maybeFailure)
Subclasses can override this.
  remoteUpdate(self, update)
  run(self, step, remote)
twisted.internet.defer.Deferred start(self)
Tell the slave to start executing the remote command.
    Inherited from Referenceable
  jellyFor(self, jellier)
(internal)
  remoteMessageReceived(self, broker, message, args, kw)
A remote message has been received.
    Inherited from Serializable
  processUniqueID(self)
Return an ID which uniquely represents this object for this process.
    Inherited from Jellyable
  getStateFor(self, jellier)

Instance Variable Summary
boolean active: whether the command is currently running

Class Variable Summary
list of one int commandCounter: provides a unique value for each RemoteCommand executed across all slaves
    Inherited from Referenceable
Implements __implemented__ = <implementedBy twisted.spread.flavors....
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
NoneType perspective = None                                                                  
    Inherited from Jellyable
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...

Method Details

__init__(self, remote_command, args)
(Constructor)

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
           (type=string)
args - arguments to send to the remote command
           (type=dict)

remote_complete(self, failure=None)

Called by the slave's buildbot.slave.bot.SlaveBuilder to notify me the remote command has finished.
Parameters:
failure
           (type=twisted.python.failure.Failure or None)
Returns:
None

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.
Parameters:
updates - list of updates from the remote command
           (type=list of [object, int])

remoteComplete(self, maybeFailure)

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.

start(self)

Tell the slave to start executing the remote command.
Returns:
a deferred that will fire when the remote command is done (with None as the result)
           (type=twisted.internet.defer.Deferred)

Instance Variable Details

active

whether the command is currently running
Type:
boolean
Value:
False                                                                  

Class Variable Details

commandCounter

provides a unique value for each RemoteCommand executed across all slaves
Type:
list of one int
Value:
[0]                                                                    

Generated by Epydoc 2.1 on Sun Dec 10 22:04:45 2006 http://epydoc.sf.net