src/eric7/Documentation/Source/eric7.Utilities.BackgroundService.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 9236
db53a9efe7ef
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Utilities.BackgroundService</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Utilities.BackgroundService</h1>
10
11 <p>
12 Module implementing a background service for the various checkers and other
13 Python interpreter dependent functions.
14 </p>
15 <h3>Global Attributes</h3>
16
17 <table>
18 <tr><td>None</td></tr>
19 </table>
20 <h3>Classes</h3>
21
22 <table>
23
24 <tr>
25 <td><a href="#BackgroundService">BackgroundService</a></td>
26 <td>Class implementing the main part of the background service.</td>
27 </tr>
28 </table>
29 <h3>Functions</h3>
30
31 <table>
32 <tr><td>None</td></tr>
33 </table>
34 <hr />
35 <hr />
36 <a NAME="BackgroundService" ID="BackgroundService"></a>
37 <h2>BackgroundService</h2>
38
39 <p>
40 Class implementing the main part of the background service.
41 </p>
42 <h3>Signals</h3>
43 <dl>
44
45 <dt>batchJobDone(function, language)</dt>
46 <dd>
47 emitted to indicate the end of
48 a batch job (str, str)
49 </dd>
50 <dt>serviceNotAvailable(function, language, filename, message)</dt>
51 <dd>
52 emitted to indicate the non-availability of a service function
53 (str, str, str, str)
54 </dd>
55 </dl>
56 <h3>Derived from</h3>
57 QTcpServer
58 <h3>Class Attributes</h3>
59
60 <table>
61 <tr><td>None</td></tr>
62 </table>
63 <h3>Class Methods</h3>
64
65 <table>
66 <tr><td>None</td></tr>
67 </table>
68 <h3>Methods</h3>
69
70 <table>
71
72 <tr>
73 <td><a href="#BackgroundService.__init__">BackgroundService</a></td>
74 <td>Constructor</td>
75 </tr>
76 <tr>
77 <td><a href="#BackgroundService.__processQueue">__processQueue</a></td>
78 <td>Private method to take the next service request and send it to the client.</td>
79 </tr>
80 <tr>
81 <td><a href="#BackgroundService.__receive">__receive</a></td>
82 <td>Private method to receive the response from the clients.</td>
83 </tr>
84 <tr>
85 <td><a href="#BackgroundService.__send">__send</a></td>
86 <td>Private method to send a job request to one of the clients.</td>
87 </tr>
88 <tr>
89 <td><a href="#BackgroundService.__startExternalClient">__startExternalClient</a></td>
90 <td>Private method to start the background client as external process.</td>
91 </tr>
92 <tr>
93 <td><a href="#BackgroundService.enqueueRequest">enqueueRequest</a></td>
94 <td>Public method implementing a queued processing of incoming events.</td>
95 </tr>
96 <tr>
97 <td><a href="#BackgroundService.on_disconnectSocket">on_disconnectSocket</a></td>
98 <td>Private slot called when connection to a client is lost.</td>
99 </tr>
100 <tr>
101 <td><a href="#BackgroundService.on_newConnection">on_newConnection</a></td>
102 <td>Private slot for new incoming connections from the clients.</td>
103 </tr>
104 <tr>
105 <td><a href="#BackgroundService.preferencesOrProjectChanged">preferencesOrProjectChanged</a></td>
106 <td>Public slot to restart the built in languages.</td>
107 </tr>
108 <tr>
109 <td><a href="#BackgroundService.requestCancel">requestCancel</a></td>
110 <td>Public method to ask a batch job to terminate.</td>
111 </tr>
112 <tr>
113 <td><a href="#BackgroundService.restartService">restartService</a></td>
114 <td>Public method to restart a given language.</td>
115 </tr>
116 <tr>
117 <td><a href="#BackgroundService.serviceConnect">serviceConnect</a></td>
118 <td>Public method to announce a new service to the background service/client.</td>
119 </tr>
120 <tr>
121 <td><a href="#BackgroundService.serviceDisconnect">serviceDisconnect</a></td>
122 <td>Public method to remove the service from the service list.</td>
123 </tr>
124 <tr>
125 <td><a href="#BackgroundService.shutdown">shutdown</a></td>
126 <td>Public method to cleanup the connections and processes when eric is shutting down.</td>
127 </tr>
128 </table>
129 <h3>Static Methods</h3>
130
131 <table>
132 <tr><td>None</td></tr>
133 </table>
134
135 <a NAME="BackgroundService.__init__" ID="BackgroundService.__init__"></a>
136 <h4>BackgroundService (Constructor)</h4>
137 <b>BackgroundService</b>(<i>parent=None</i>)
138
139 <p>
140 Constructor
141 </p>
142 <dl>
143
144 <dt><i>parent</i> (QObject)</dt>
145 <dd>
146 reference to the parent object
147 </dd>
148 </dl>
149 <a NAME="BackgroundService.__processQueue" ID="BackgroundService.__processQueue"></a>
150 <h4>BackgroundService.__processQueue</h4>
151 <b>__processQueue</b>(<i></i>)
152
153 <p>
154 Private method to take the next service request and send it to the
155 client.
156 </p>
157 <a NAME="BackgroundService.__receive" ID="BackgroundService.__receive"></a>
158 <h4>BackgroundService.__receive</h4>
159 <b>__receive</b>(<i>lang</i>)
160
161 <p>
162 Private method to receive the response from the clients.
163 </p>
164 <dl>
165
166 <dt><i>lang</i> (str)</dt>
167 <dd>
168 language of the incoming connection
169 </dd>
170 </dl>
171 <dl>
172
173 <dt>Raises <b>RuntimeError</b>:</dt>
174 <dd>
175 raised if hashes don't match
176 </dd>
177 </dl>
178 <a NAME="BackgroundService.__send" ID="BackgroundService.__send"></a>
179 <h4>BackgroundService.__send</h4>
180 <b>__send</b>(<i>fx, lang, fn, data</i>)
181
182 <p>
183 Private method to send a job request to one of the clients.
184 </p>
185 <dl>
186
187 <dt><i>fx</i> (str)</dt>
188 <dd>
189 remote function name to execute
190 </dd>
191 <dt><i>lang</i> (str)</dt>
192 <dd>
193 language to connect to
194 </dd>
195 <dt><i>fn</i> (str)</dt>
196 <dd>
197 filename for identification
198 </dd>
199 <dt><i>data</i> (any basic datatype)</dt>
200 <dd>
201 function argument(s)
202 </dd>
203 </dl>
204 <a NAME="BackgroundService.__startExternalClient" ID="BackgroundService.__startExternalClient"></a>
205 <h4>BackgroundService.__startExternalClient</h4>
206 <b>__startExternalClient</b>(<i>interpreter, port</i>)
207
208 <p>
209 Private method to start the background client as external process.
210 </p>
211 <dl>
212
213 <dt><i>interpreter</i> (str)</dt>
214 <dd>
215 path and name of the executable to start
216 </dd>
217 <dt><i>port</i> (int)</dt>
218 <dd>
219 socket port to which the interpreter should connect
220 </dd>
221 </dl>
222 <dl>
223 <dt>Return:</dt>
224 <dd>
225 the process object
226 </dd>
227 </dl>
228 <dl>
229 <dt>Return Type:</dt>
230 <dd>
231 QProcess or None
232 </dd>
233 </dl>
234 <a NAME="BackgroundService.enqueueRequest" ID="BackgroundService.enqueueRequest"></a>
235 <h4>BackgroundService.enqueueRequest</h4>
236 <b>enqueueRequest</b>(<i>fx, lang, fn, data</i>)
237
238 <p>
239 Public method implementing a queued processing of incoming events.
240 </p>
241 <p>
242 Duplicate service requests update an older request to avoid overrun or
243 starving of the services.
244 </p>
245 <dl>
246
247 <dt><i>fx</i> (str)</dt>
248 <dd>
249 function name of the service
250 </dd>
251 <dt><i>lang</i> (str)</dt>
252 <dd>
253 language to connect to
254 </dd>
255 <dt><i>fn</i> (str)</dt>
256 <dd>
257 filename for identification
258 </dd>
259 <dt><i>data</i> (any basic datatype)</dt>
260 <dd>
261 function argument(s)
262 </dd>
263 </dl>
264 <a NAME="BackgroundService.on_disconnectSocket" ID="BackgroundService.on_disconnectSocket"></a>
265 <h4>BackgroundService.on_disconnectSocket</h4>
266 <b>on_disconnectSocket</b>(<i>lang</i>)
267
268 <p>
269 Private slot called when connection to a client is lost.
270 </p>
271 <dl>
272
273 <dt><i>lang</i> (str)</dt>
274 <dd>
275 client language which connection is lost
276 </dd>
277 </dl>
278 <a NAME="BackgroundService.on_newConnection" ID="BackgroundService.on_newConnection"></a>
279 <h4>BackgroundService.on_newConnection</h4>
280 <b>on_newConnection</b>(<i></i>)
281
282 <p>
283 Private slot for new incoming connections from the clients.
284 </p>
285 <a NAME="BackgroundService.preferencesOrProjectChanged" ID="BackgroundService.preferencesOrProjectChanged"></a>
286 <h4>BackgroundService.preferencesOrProjectChanged</h4>
287 <b>preferencesOrProjectChanged</b>(<i></i>)
288
289 <p>
290 Public slot to restart the built in languages.
291 </p>
292 <a NAME="BackgroundService.requestCancel" ID="BackgroundService.requestCancel"></a>
293 <h4>BackgroundService.requestCancel</h4>
294 <b>requestCancel</b>(<i>fx, lang</i>)
295
296 <p>
297 Public method to ask a batch job to terminate.
298 </p>
299 <dl>
300
301 <dt><i>fx</i> (str)</dt>
302 <dd>
303 function name of the service
304 </dd>
305 <dt><i>lang</i> (str)</dt>
306 <dd>
307 language to connect to
308 </dd>
309 </dl>
310 <a NAME="BackgroundService.restartService" ID="BackgroundService.restartService"></a>
311 <h4>BackgroundService.restartService</h4>
312 <b>restartService</b>(<i>language, forceKill=False</i>)
313
314 <p>
315 Public method to restart a given language.
316 </p>
317 <dl>
318
319 <dt><i>language</i> (str)</dt>
320 <dd>
321 to restart
322 </dd>
323 <dt><i>forceKill</i> (bool)</dt>
324 <dd>
325 flag to kill a running task
326 </dd>
327 </dl>
328 <a NAME="BackgroundService.serviceConnect" ID="BackgroundService.serviceConnect"></a>
329 <h4>BackgroundService.serviceConnect</h4>
330 <b>serviceConnect</b>(<i>fx, lang, modulepath, module, callback, onErrorCallback=None, onBatchDone=None</i>)
331
332 <p>
333 Public method to announce a new service to the background
334 service/client.
335 </p>
336 <dl>
337
338 <dt><i>fx</i> (str)</dt>
339 <dd>
340 function name of the service
341 </dd>
342 <dt><i>lang</i> (str)</dt>
343 <dd>
344 language of the new service
345 </dd>
346 <dt><i>modulepath</i> (str)</dt>
347 <dd>
348 full path to the module
349 </dd>
350 <dt><i>module</i> (str)</dt>
351 <dd>
352 name to import
353 </dd>
354 <dt><i>callback</i> (function)</dt>
355 <dd>
356 function called on service response
357 </dd>
358 <dt><i>onErrorCallback</i></dt>
359 <dd>
360 function called, if client isn't available
361 (function)
362 </dd>
363 <dt><i>onBatchDone</i> (function)</dt>
364 <dd>
365 function called when a batch job is done
366 </dd>
367 </dl>
368 <a NAME="BackgroundService.serviceDisconnect" ID="BackgroundService.serviceDisconnect"></a>
369 <h4>BackgroundService.serviceDisconnect</h4>
370 <b>serviceDisconnect</b>(<i>fx, lang</i>)
371
372 <p>
373 Public method to remove the service from the service list.
374 </p>
375 <dl>
376
377 <dt><i>fx</i> (function)</dt>
378 <dd>
379 function name of the service
380 </dd>
381 <dt><i>lang</i> (str)</dt>
382 <dd>
383 language of the service
384 </dd>
385 </dl>
386 <a NAME="BackgroundService.shutdown" ID="BackgroundService.shutdown"></a>
387 <h4>BackgroundService.shutdown</h4>
388 <b>shutdown</b>(<i></i>)
389
390 <p>
391 Public method to cleanup the connections and processes when eric is
392 shutting down.
393 </p>
394 <div align="right"><a href="#top">Up</a></div>
395 <hr />
396 </body></html>

eric ide

mercurial