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

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

eric ide

mercurial