1   
 2   
 3   
 4   
 5   
 6   
 7   
 8   
 9   
10   
11   
12   
13   
14   
15   
16   
17  from zope.interface import Interface 
18   
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   
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   
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   
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   
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