1
2
3
4
5
6
7
8
9
10
11
12
13
14 from zope.interface import Interface
15
16 -class IJob(Interface):
17 """
18 Persistent object that contains the entry-point function for running a job.
19 """
21 """
22 Begins the job-running process. Does setup, then calls self.run().
23 """
25 """
26 Contains all job-specific code. This will be overridden in subclasses
27 to provide the ability to run different kinds of jobs.
28 """
30 """
31 Called when the job is finished.
32 """
34 """
35 Halt the running of the job. If necessary, send signals to any
36 subprocesses that are involved in job running.
37 """
39 """
40 Set the current status of the running job to C{msg}.
41 """
43 """
44 Get the L{IJobStatus} associated with this job.
45 """
46
48 """
49 Contains interesting information about a job, including state, start and
50 finish times, and log file.
51 """
53 """
54 Return the IJob associated with this status object.
55 """
57 """
58 Returns a (start, end) tuple, indicating when the Job started and
59 finished. If the Job is still running, end will be None.
60 """
62 """
63 Return the ILogFile that contains the job output.
64 """
66 """
67 Return a boolean indicating whether or not the job has finished.
68 """
70 """
71 Return a Deferred that will fire when the IJob finishes. If the IJob
72 has finished, this Deferred will fire right away.
73 """
75 """
76 Return a constant describing the results of the job, from jobs.status:
77 SUCCESS or FAILURE.
78 """
79
81 """
82 Provides a hub for the job subsystem. Can be queried to find the status of
83 running or previous jobs. Jobs are created from here.
84 """
86 """
87 Create an instance of C{klass}, which must implement L{IJob}.
88
89 @return: A Job instance.
90 @rtype: IJob
91 """
93 """
94 Return the IJobStatus for a given IJob or job id.
95 """
97 """
98 Return IJobStatus objects that have yet to finish.
99 """
101 """
102 Return IJobStatus objects that have started and have yet to finish.
103 """
105 """
106 Return IJobStatus objects that have yet to start.
107 """
108
109 -class IJobLogFile(Interface):
110 """
111 Job output of any kind.
112 """
114 """
115 Write C{data} to the Log.
116 """
118 """
119 No further data will be added to the log file, so close it and notify
120 anyone who cares.
121 """
122 - def subscribe(subscriber, catchup=False):
123 """
124 Register to receive output as data is added to the log. If catchup is
125 True, log contents up to that point will be returned immediately to the
126 receiver.
127
128 @param subscriber: The receiver of data as it comes in
129 @type subscriber: file-like
130 """
131 - def unsubscribe(subscriber):
132 """
133 Remove a previously registered subscriber.
134 """
136 """
137 Return the IJobStatus that owns this log.
138 """
140 """
141 Return the filename of the file on disk containing the log data.
142 """
144 """
145 Return a boolean indicating whether or not the log has finished.
146 """
148 """
149 Return a Deferred that will fire when the log finishes. If the log has
150 finished, this Deferred will fire right away.
151 """
152