| OLD | NEW |
| (Empty) |
| 1 | |
| 2 from zope.interface import Interface | |
| 3 | |
| 4 class ISlaveCommand(Interface): | |
| 5 """This interface is implemented by all of the buildslave's Command | |
| 6 subclasses. It specifies how the buildslave can start, interrupt, and | |
| 7 query the various Commands running on behalf of the buildmaster.""" | |
| 8 | |
| 9 def __init__(builder, stepId, args): | |
| 10 """Create the Command. 'builder' is a reference to the parent | |
| 11 buildbot.bot.SlaveBuilder instance, which will be used to send status | |
| 12 updates (by calling builder.sendStatus). 'stepId' is a random string | |
| 13 which helps correlate slave logs with the master. 'args' is a dict of | |
| 14 arguments that comes from the master-side BuildStep, with contents | |
| 15 that are specific to the individual Command subclass. | |
| 16 | |
| 17 This method is not intended to be subclassed.""" | |
| 18 | |
| 19 def setup(args): | |
| 20 """This method is provided for subclasses to override, to extract | |
| 21 parameters from the 'args' dictionary. The default implemention does | |
| 22 nothing. It will be called from __init__""" | |
| 23 | |
| 24 def start(): | |
| 25 """Begin the command, and return a Deferred. | |
| 26 | |
| 27 While the command runs, it should send status updates to the | |
| 28 master-side BuildStep by calling self.sendStatus(status). The | |
| 29 'status' argument is typically a dict with keys like 'stdout', | |
| 30 'stderr', and 'rc'. | |
| 31 | |
| 32 When the step completes, it should fire the Deferred (the results are | |
| 33 not used). If an exception occurs during execution, it may also | |
| 34 errback the deferred, however any reasonable errors should be trapped | |
| 35 and indicated with a non-zero 'rc' status rather than raising an | |
| 36 exception. Exceptions should indicate problems within the buildbot | |
| 37 itself, not problems in the project being tested. | |
| 38 | |
| 39 """ | |
| 40 | |
| 41 def interrupt(): | |
| 42 """This is called to tell the Command that the build is being stopped | |
| 43 and therefore the command should be terminated as quickly as | |
| 44 possible. The command may continue to send status updates, up to and | |
| 45 including an 'rc' end-of-command update (which should indicate an | |
| 46 error condition). The Command's deferred should still be fired when | |
| 47 the command has finally completed. | |
| 48 | |
| 49 If the build is being stopped because the slave it shutting down or | |
| 50 because the connection to the buildmaster has been lost, the status | |
| 51 updates will simply be discarded. The Command does not need to be | |
| 52 aware of this. | |
| 53 | |
| 54 Child shell processes should be killed. Simple ShellCommand classes | |
| 55 can just insert a header line indicating that the process will be | |
| 56 killed, then os.kill() the child.""" | |
| OLD | NEW |