eric6/Documentation/Source/eric6.Utilities.BackgroundService.html

changeset 7965
48fbf9149d16
parent 7900
72b88fb20261
child 7989
a21d673a8f99
equal deleted inserted replaced
7963:19bbd56ac5f2 7965:48fbf9149d16
22 <a NAME="top" ID="top"></a> 22 <a NAME="top" ID="top"></a>
23 <h1>eric6.Utilities.BackgroundService</h1> 23 <h1>eric6.Utilities.BackgroundService</h1>
24 24
25 <p> 25 <p>
26 Module implementing a background service for the various checkers and other 26 Module implementing a background service for the various checkers and other
27 python interpreter dependent functions. 27 Python interpreter dependent functions.
28 </p> 28 </p>
29 <h3>Global Attributes</h3> 29 <h3>Global Attributes</h3>
30 30
31 <table> 31 <table>
32 <tr><td>None</td></tr> 32 <tr><td>None</td></tr>
83 83
84 <table> 84 <table>
85 85
86 <tr> 86 <tr>
87 <td><a href="#BackgroundService.__init__">BackgroundService</a></td> 87 <td><a href="#BackgroundService.__init__">BackgroundService</a></td>
88 <td>Constructor of the BackgroundService class.</td> 88 <td>Constructor</td>
89 </tr> 89 </tr>
90 <tr> 90 <tr>
91 <td><a href="#BackgroundService.__processQueue">__processQueue</a></td> 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> 92 <td>Private method to take the next service request and send it to the client.</td>
93 </tr> 93 </tr>
103 <td><a href="#BackgroundService.__startExternalClient">__startExternalClient</a></td> 103 <td><a href="#BackgroundService.__startExternalClient">__startExternalClient</a></td>
104 <td>Private method to start the background client as external process.</td> 104 <td>Private method to start the background client as external process.</td>
105 </tr> 105 </tr>
106 <tr> 106 <tr>
107 <td><a href="#BackgroundService.enqueueRequest">enqueueRequest</a></td> 107 <td><a href="#BackgroundService.enqueueRequest">enqueueRequest</a></td>
108 <td>Public method implementing a queued processing of incomming events.</td> 108 <td>Public method implementing a queued processing of incoming events.</td>
109 </tr> 109 </tr>
110 <tr> 110 <tr>
111 <td><a href="#BackgroundService.on_disconnectSocket">on_disconnectSocket</a></td> 111 <td><a href="#BackgroundService.on_disconnectSocket">on_disconnectSocket</a></td>
112 <td>Private slot called when connection to a client is lost.</td> 112 <td>Private slot called when connection to a client is lost.</td>
113 </tr> 113 </tr>
114 <tr> 114 <tr>
115 <td><a href="#BackgroundService.on_newConnection">on_newConnection</a></td> 115 <td><a href="#BackgroundService.on_newConnection">on_newConnection</a></td>
116 <td>Private slot for new incomming connections from the clients.</td> 116 <td>Private slot for new incoming connections from the clients.</td>
117 </tr> 117 </tr>
118 <tr> 118 <tr>
119 <td><a href="#BackgroundService.preferencesOrProjectChanged">preferencesOrProjectChanged</a></td> 119 <td><a href="#BackgroundService.preferencesOrProjectChanged">preferencesOrProjectChanged</a></td>
120 <td>Public slot to restart the built in languages.</td> 120 <td>Public slot to restart the built in languages.</td>
121 </tr> 121 </tr>
123 <td><a href="#BackgroundService.requestCancel">requestCancel</a></td> 123 <td><a href="#BackgroundService.requestCancel">requestCancel</a></td>
124 <td>Public method to ask a batch job to terminate.</td> 124 <td>Public method to ask a batch job to terminate.</td>
125 </tr> 125 </tr>
126 <tr> 126 <tr>
127 <td><a href="#BackgroundService.restartService">restartService</a></td> 127 <td><a href="#BackgroundService.restartService">restartService</a></td>
128 <td>Public method to restart a given lanuage.</td> 128 <td>Public method to restart a given language.</td>
129 </tr> 129 </tr>
130 <tr> 130 <tr>
131 <td><a href="#BackgroundService.serviceConnect">serviceConnect</a></td> 131 <td><a href="#BackgroundService.serviceConnect">serviceConnect</a></td>
132 <td>Public method to announce a new service to the background service/client.</td> 132 <td>Public method to announce a new service to the background service/client.</td>
133 </tr> 133 </tr>
149 <a NAME="BackgroundService.__init__" ID="BackgroundService.__init__"></a> 149 <a NAME="BackgroundService.__init__" ID="BackgroundService.__init__"></a>
150 <h4>BackgroundService (Constructor)</h4> 150 <h4>BackgroundService (Constructor)</h4>
151 <b>BackgroundService</b>(<i></i>) 151 <b>BackgroundService</b>(<i></i>)
152 152
153 <p> 153 <p>
154 Constructor of the BackgroundService class. 154 Constructor
155 </p> 155 </p>
156 <a NAME="BackgroundService.__processQueue" ID="BackgroundService.__processQueue"></a> 156 <a NAME="BackgroundService.__processQueue" ID="BackgroundService.__processQueue"></a>
157 <h4>BackgroundService.__processQueue</h4> 157 <h4>BackgroundService.__processQueue</h4>
158 <b>__processQueue</b>(<i></i>) 158 <b>__processQueue</b>(<i></i>)
159 159
168 <p> 168 <p>
169 Private method to receive the response from the clients. 169 Private method to receive the response from the clients.
170 </p> 170 </p>
171 <dl> 171 <dl>
172 172
173 <dt><i>lang</i></dt> 173 <dt><i>lang</i> (str)</dt>
174 <dd> 174 <dd>
175 language of the incomming connection (str) 175 language of the incoming connection
176 </dd> 176 </dd>
177 </dl> 177 </dl>
178 <dl> 178 <dl>
179 179
180 <dt>Raises <b>RuntimeError</b>:</dt> 180 <dt>Raises <b>RuntimeError</b>:</dt>
189 <p> 189 <p>
190 Private method to send a job request to one of the clients. 190 Private method to send a job request to one of the clients.
191 </p> 191 </p>
192 <dl> 192 <dl>
193 193
194 <dt><i>fx</i></dt> 194 <dt><i>fx</i> (str)</dt>
195 <dd> 195 <dd>
196 remote function name to execute (str) 196 remote function name to execute
197 </dd> 197 </dd>
198 <dt><i>lang</i></dt> 198 <dt><i>lang</i> (str)</dt>
199 <dd> 199 <dd>
200 language to connect to (str) 200 language to connect to
201 </dd> 201 </dd>
202 <dt><i>fn</i></dt> 202 <dt><i>fn</i> (str)</dt>
203 <dd> 203 <dd>
204 filename for identification (str) 204 filename for identification
205 </dd> 205 </dd>
206 <dt><i>data</i></dt> 206 <dt><i>data</i> (any basic datatype)</dt>
207 <dd> 207 <dd>
208 function argument(s) (any basic datatype) 208 function argument(s)
209 </dd> 209 </dd>
210 </dl> 210 </dl>
211 <a NAME="BackgroundService.__startExternalClient" ID="BackgroundService.__startExternalClient"></a> 211 <a NAME="BackgroundService.__startExternalClient" ID="BackgroundService.__startExternalClient"></a>
212 <h4>BackgroundService.__startExternalClient</h4> 212 <h4>BackgroundService.__startExternalClient</h4>
213 <b>__startExternalClient</b>(<i>interpreter, port</i>) 213 <b>__startExternalClient</b>(<i>interpreter, port</i>)
215 <p> 215 <p>
216 Private method to start the background client as external process. 216 Private method to start the background client as external process.
217 </p> 217 </p>
218 <dl> 218 <dl>
219 219
220 <dt><i>interpreter</i></dt> 220 <dt><i>interpreter</i> (str)</dt>
221 <dd> 221 <dd>
222 path and name of the executable to start (string) 222 path and name of the executable to start
223 </dd> 223 </dd>
224 <dt><i>port</i></dt> 224 <dt><i>port</i> (int)</dt>
225 <dd> 225 <dd>
226 socket port to which the interpreter should connect (int) 226 socket port to which the interpreter should connect
227 </dd> 227 </dd>
228 </dl> 228 </dl>
229 <dl> 229 <dl>
230 <dt>Returns:</dt> 230 <dt>Returns:</dt>
231 <dd> 231 <dd>
232 the process object (QProcess or None) 232 the process object
233 </dd>
234 </dl>
235 <dl>
236 <dt>Return Type:</dt>
237 <dd>
238 QProcess or None
233 </dd> 239 </dd>
234 </dl> 240 </dl>
235 <a NAME="BackgroundService.enqueueRequest" ID="BackgroundService.enqueueRequest"></a> 241 <a NAME="BackgroundService.enqueueRequest" ID="BackgroundService.enqueueRequest"></a>
236 <h4>BackgroundService.enqueueRequest</h4> 242 <h4>BackgroundService.enqueueRequest</h4>
237 <b>enqueueRequest</b>(<i>fx, lang, fn, data</i>) 243 <b>enqueueRequest</b>(<i>fx, lang, fn, data</i>)
238 244
239 <p> 245 <p>
240 Public method implementing a queued processing of incomming events. 246 Public method implementing a queued processing of incoming events.
241 </p> 247 </p>
242 <p> 248 <p>
243 Dublicate service requests updates an older request to avoid overrun or 249 Duplicate service requests update an older request to avoid overrun or
244 starving of the services. 250 starving of the services.
245 </p> 251 </p>
246 <dl> 252 <dl>
247 253
248 <dt><i>fx</i></dt> 254 <dt><i>fx</i> (str)</dt>
249 <dd> 255 <dd>
250 function name of the service (str) 256 function name of the service
251 </dd> 257 </dd>
252 <dt><i>lang</i></dt> 258 <dt><i>lang</i> (str)</dt>
253 <dd> 259 <dd>
254 language to connect to (str) 260 language to connect to
255 </dd> 261 </dd>
256 <dt><i>fn</i></dt> 262 <dt><i>fn</i> (str)</dt>
257 <dd> 263 <dd>
258 filename for identification (str) 264 filename for identification
259 </dd> 265 </dd>
260 <dt><i>data</i></dt> 266 <dt><i>data</i> (any basic datatype)</dt>
261 <dd> 267 <dd>
262 function argument(s) (any basic datatype(s)) 268 function argument(s)
263 </dd> 269 </dd>
264 </dl> 270 </dl>
265 <a NAME="BackgroundService.on_disconnectSocket" ID="BackgroundService.on_disconnectSocket"></a> 271 <a NAME="BackgroundService.on_disconnectSocket" ID="BackgroundService.on_disconnectSocket"></a>
266 <h4>BackgroundService.on_disconnectSocket</h4> 272 <h4>BackgroundService.on_disconnectSocket</h4>
267 <b>on_disconnectSocket</b>(<i>lang</i>) 273 <b>on_disconnectSocket</b>(<i>lang</i>)
269 <p> 275 <p>
270 Private slot called when connection to a client is lost. 276 Private slot called when connection to a client is lost.
271 </p> 277 </p>
272 <dl> 278 <dl>
273 279
274 <dt><i>lang</i></dt> 280 <dt><i>lang</i> (str)</dt>
275 <dd> 281 <dd>
276 client language which connection is lost (str) 282 client language which connection is lost
277 </dd> 283 </dd>
278 </dl> 284 </dl>
279 <a NAME="BackgroundService.on_newConnection" ID="BackgroundService.on_newConnection"></a> 285 <a NAME="BackgroundService.on_newConnection" ID="BackgroundService.on_newConnection"></a>
280 <h4>BackgroundService.on_newConnection</h4> 286 <h4>BackgroundService.on_newConnection</h4>
281 <b>on_newConnection</b>(<i></i>) 287 <b>on_newConnection</b>(<i></i>)
282 288
283 <p> 289 <p>
284 Private slot for new incomming connections from the clients. 290 Private slot for new incoming connections from the clients.
285 </p> 291 </p>
286 <a NAME="BackgroundService.preferencesOrProjectChanged" ID="BackgroundService.preferencesOrProjectChanged"></a> 292 <a NAME="BackgroundService.preferencesOrProjectChanged" ID="BackgroundService.preferencesOrProjectChanged"></a>
287 <h4>BackgroundService.preferencesOrProjectChanged</h4> 293 <h4>BackgroundService.preferencesOrProjectChanged</h4>
288 <b>preferencesOrProjectChanged</b>(<i></i>) 294 <b>preferencesOrProjectChanged</b>(<i></i>)
289 295
297 <p> 303 <p>
298 Public method to ask a batch job to terminate. 304 Public method to ask a batch job to terminate.
299 </p> 305 </p>
300 <dl> 306 <dl>
301 307
302 <dt><i>fx</i></dt> 308 <dt><i>fx</i> (str)</dt>
303 <dd> 309 <dd>
304 function name of the service (str) 310 function name of the service
305 </dd> 311 </dd>
306 <dt><i>lang</i></dt> 312 <dt><i>lang</i> (str)</dt>
307 <dd> 313 <dd>
308 language to connect to (str) 314 language to connect to
309 </dd> 315 </dd>
310 </dl> 316 </dl>
311 <a NAME="BackgroundService.restartService" ID="BackgroundService.restartService"></a> 317 <a NAME="BackgroundService.restartService" ID="BackgroundService.restartService"></a>
312 <h4>BackgroundService.restartService</h4> 318 <h4>BackgroundService.restartService</h4>
313 <b>restartService</b>(<i>language, forceKill=False</i>) 319 <b>restartService</b>(<i>language, forceKill=False</i>)
314 320
315 <p> 321 <p>
316 Public method to restart a given lanuage. 322 Public method to restart a given language.
317 </p> 323 </p>
318 <dl> 324 <dl>
319 325
320 <dt><i>language</i></dt> 326 <dt><i>language</i> (str)</dt>
321 <dd> 327 <dd>
322 to restart (str) 328 to restart
323 </dd> 329 </dd>
324 <dt><i>forceKill</i></dt> 330 <dt><i>forceKill</i> (bool)</dt>
325 <dd> 331 <dd>
326 flag to kill a running task (bool) 332 flag to kill a running task
327 </dd> 333 </dd>
328 </dl> 334 </dl>
329 <a NAME="BackgroundService.serviceConnect" ID="BackgroundService.serviceConnect"></a> 335 <a NAME="BackgroundService.serviceConnect" ID="BackgroundService.serviceConnect"></a>
330 <h4>BackgroundService.serviceConnect</h4> 336 <h4>BackgroundService.serviceConnect</h4>
331 <b>serviceConnect</b>(<i>fx, lang, modulepath, module, callback, onErrorCallback=None, onBatchDone=None</i>) 337 <b>serviceConnect</b>(<i>fx, lang, modulepath, module, callback, onErrorCallback=None, onBatchDone=None</i>)
334 Public method to announce a new service to the background 340 Public method to announce a new service to the background
335 service/client. 341 service/client.
336 </p> 342 </p>
337 <dl> 343 <dl>
338 344
339 <dt><i>fx</i></dt> 345 <dt><i>fx</i> (str)</dt>
340 <dd> 346 <dd>
341 function name of the service (str) 347 function name of the service
342 </dd> 348 </dd>
343 <dt><i>lang</i></dt> 349 <dt><i>lang</i> (str)</dt>
344 <dd> 350 <dd>
345 language of the new service (str) 351 language of the new service
346 </dd> 352 </dd>
347 <dt><i>modulepath</i></dt> 353 <dt><i>modulepath</i> (str)</dt>
348 <dd> 354 <dd>
349 full path to the module (str) 355 full path to the module
350 </dd> 356 </dd>
351 <dt><i>module</i></dt> 357 <dt><i>module</i> (str)</dt>
352 <dd> 358 <dd>
353 name to import (str) 359 name to import
354 </dd> 360 </dd>
355 <dt><i>callback</i></dt> 361 <dt><i>callback</i> (function)</dt>
356 <dd> 362 <dd>
357 function called on service response (function) 363 function called on service response
358 </dd> 364 </dd>
359 <dt><i>onErrorCallback</i></dt> 365 <dt><i>onErrorCallback</i></dt>
360 <dd> 366 <dd>
361 function called, if client isn't available 367 function called, if client isn't available
362 (function) 368 (function)
363 </dd> 369 </dd>
364 <dt><i>onBatchDone</i></dt> 370 <dt><i>onBatchDone</i> (function)</dt>
365 <dd> 371 <dd>
366 function called when a batch job is done (function) 372 function called when a batch job is done
367 </dd> 373 </dd>
368 </dl> 374 </dl>
369 <a NAME="BackgroundService.serviceDisconnect" ID="BackgroundService.serviceDisconnect"></a> 375 <a NAME="BackgroundService.serviceDisconnect" ID="BackgroundService.serviceDisconnect"></a>
370 <h4>BackgroundService.serviceDisconnect</h4> 376 <h4>BackgroundService.serviceDisconnect</h4>
371 <b>serviceDisconnect</b>(<i>fx, lang</i>) 377 <b>serviceDisconnect</b>(<i>fx, lang</i>)
373 <p> 379 <p>
374 Public method to remove the service from the service list. 380 Public method to remove the service from the service list.
375 </p> 381 </p>
376 <dl> 382 <dl>
377 383
378 <dt><i>fx</i></dt> 384 <dt><i>fx</i> (function)</dt>
379 <dd> 385 <dd>
380 function name of the service (function) 386 function name of the service
381 </dd> 387 </dd>
382 <dt><i>lang</i></dt> 388 <dt><i>lang</i> (str)</dt>
383 <dd> 389 <dd>
384 language of the service (str) 390 language of the service
385 </dd> 391 </dd>
386 </dl> 392 </dl>
387 <a NAME="BackgroundService.shutdown" ID="BackgroundService.shutdown"></a> 393 <a NAME="BackgroundService.shutdown" ID="BackgroundService.shutdown"></a>
388 <h4>BackgroundService.shutdown</h4> 394 <h4>BackgroundService.shutdown</h4>
389 <b>shutdown</b>(<i></i>) 395 <b>shutdown</b>(<i></i>)

eric ide

mercurial