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

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

eric ide

mercurial