Package buildslave :: Module interfaces
[frames] | no frames]

Source Code for Module buildslave.interfaces

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16   
17  from zope.interface import Interface 
18   
19 -class ISlaveCommand(Interface):
20 """This interface is implemented by all of the buildslave's Command 21 subclasses. It specifies how the buildslave can start, interrupt, and 22 query the various Commands running on behalf of the buildmaster.""" 23
24 - def __init__(builder, stepId, args):
25 """Create the Command. 'builder' is a reference to the parent 26 buildbot.bot.SlaveBuilder instance, which will be used to send status 27 updates (by calling builder.sendStatus). 'stepId' is a random string 28 which helps correlate slave logs with the master. 'args' is a dict of 29 arguments that comes from the master-side BuildStep, with contents 30 that are specific to the individual Command subclass. 31 32 This method is not intended to be subclassed."""
33
34 - def setup(args):
35 """This method is provided for subclasses to override, to extract 36 parameters from the 'args' dictionary. The default implemention does 37 nothing. It will be called from __init__"""
38
39 - def start():
40 """Begin the command, and return a Deferred. 41 42 While the command runs, it should send status updates to the 43 master-side BuildStep by calling self.sendStatus(status). The 44 'status' argument is typically a dict with keys like 'stdout', 45 'stderr', and 'rc'. 46 47 When the step completes, it should fire the Deferred (the results are 48 not used). If an exception occurs during execution, it may also 49 errback the deferred, however any reasonable errors should be trapped 50 and indicated with a non-zero 'rc' status rather than raising an 51 exception. Exceptions should indicate problems within the buildbot 52 itself, not problems in the project being tested. 53 54 """
55
56 - def interrupt():
57 """This is called to tell the Command that the build is being stopped 58 and therefore the command should be terminated as quickly as 59 possible. The command may continue to send status updates, up to and 60 including an 'rc' end-of-command update (which should indicate an 61 error condition). The Command's deferred should still be fired when 62 the command has finally completed. 63 64 If the build is being stopped because the slave it shutting down or 65 because the connection to the buildmaster has been lost, the status 66 updates will simply be discarded. The Command does not need to be 67 aware of this. 68 69 Child shell processes should be killed. Simple ShellCommand classes 70 can just insert a header line indicating that the process will be 71 killed, then os.kill() the child."""
72