Documentation/Source/eric5.Utilities.BackgroundService.html

branch
BgService
changeset 3209
c5432abceb25
child 3456
96232974dcdb
equal deleted inserted replaced
3177:5af61402d74d 3209:c5432abceb25
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric5.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><a NAME="top" ID="top"></a>
22 <h1>eric5.Utilities.BackgroundService</h1>
23 <p>
24 Module implementing a background service for the various checkers and other
25 python interpreter dependent functions.
26 </p>
27 <h3>Global Attributes</h3>
28 <table>
29 <tr><td>None</td></tr>
30 </table>
31 <h3>Classes</h3>
32 <table>
33 <tr>
34 <td><a href="#BackgroundService">BackgroundService</a></td>
35 <td>Class implementing the main part of the background service.</td>
36 </tr>
37 </table>
38 <h3>Functions</h3>
39 <table>
40 <tr><td>None</td></tr>
41 </table>
42 <hr /><hr />
43 <a NAME="BackgroundService" ID="BackgroundService"></a>
44 <h2>BackgroundService</h2>
45 <p>
46 Class implementing the main part of the background service.
47 </p>
48 <h3>Derived from</h3>
49 QTcpServer
50 <h3>Class Attributes</h3>
51 <table>
52 <tr><td>None</td></tr>
53 </table>
54 <h3>Class Methods</h3>
55 <table>
56 <tr><td>None</td></tr>
57 </table>
58 <h3>Methods</h3>
59 <table>
60 <tr>
61 <td><a href="#BackgroundService.__init__">BackgroundService</a></td>
62 <td>Constructor of the BackgroundService class.</td>
63 </tr><tr>
64 <td><a href="#BackgroundService.__postResult">__postResult</a></td>
65 <td>Private method to emit the correspondig signal for the returned function.</td>
66 </tr><tr>
67 <td><a href="#BackgroundService.__processQueue">__processQueue</a></td>
68 <td>Private method to take the next service request and send it to the client.</td>
69 </tr><tr>
70 <td><a href="#BackgroundService.__receive">__receive</a></td>
71 <td>Private method to receive the response from the clients.</td>
72 </tr><tr>
73 <td><a href="#BackgroundService.__send">__send</a></td>
74 <td>Private method to send a job request to one of the clients.</td>
75 </tr><tr>
76 <td><a href="#BackgroundService.__startExternalClient">__startExternalClient</a></td>
77 <td>Private method to start the background client as external process.</td>
78 </tr><tr>
79 <td><a href="#BackgroundService.__startInternalClient">__startInternalClient</a></td>
80 <td>Private method to start the background client as internal thread.</td>
81 </tr><tr>
82 <td><a href="#BackgroundService.enqueueRequest">enqueueRequest</a></td>
83 <td>Implement a queued processing of incomming events.</td>
84 </tr><tr>
85 <td><a href="#BackgroundService.on_newConnection">on_newConnection</a></td>
86 <td>Slot for new incomming connections from the clients.</td>
87 </tr><tr>
88 <td><a href="#BackgroundService.serviceConnect">serviceConnect</a></td>
89 <td>Announce a new service to the background service/ client.</td>
90 </tr><tr>
91 <td><a href="#BackgroundService.serviceDisconnect">serviceDisconnect</a></td>
92 <td>Remove the service from the service list.</td>
93 </tr><tr>
94 <td><a href="#BackgroundService.shutdown">shutdown</a></td>
95 <td>Cleanup the connections and processes when Eric is shuting down.</td>
96 </tr>
97 </table>
98 <h3>Static Methods</h3>
99 <table>
100 <tr><td>None</td></tr>
101 </table>
102 <a NAME="BackgroundService.__init__" ID="BackgroundService.__init__"></a>
103 <h4>BackgroundService (Constructor)</h4>
104 <b>BackgroundService</b>(<i></i>)
105 <p>
106 Constructor of the BackgroundService class.
107 </p><a NAME="BackgroundService.__postResult" ID="BackgroundService.__postResult"></a>
108 <h4>BackgroundService.__postResult</h4>
109 <b>__postResult</b>(<i>fx, fn, data</i>)
110 <p>
111 Private method to emit the correspondig signal for the returned
112 function.
113 </p><dl>
114 <dt><i>fx</i></dt>
115 <dd>
116 remote function name to execute (str)
117 </dd><dt><i>fn</i></dt>
118 <dd>
119 filename for identification (str)
120 </dd><dt><i>data</i></dt>
121 <dd>
122 function argument(s) (any basic datatype)
123 </dd>
124 </dl><a NAME="BackgroundService.__processQueue" ID="BackgroundService.__processQueue"></a>
125 <h4>BackgroundService.__processQueue</h4>
126 <b>__processQueue</b>(<i></i>)
127 <p>
128 Private method to take the next service request and send it to the
129 client.
130 </p><a NAME="BackgroundService.__receive" ID="BackgroundService.__receive"></a>
131 <h4>BackgroundService.__receive</h4>
132 <b>__receive</b>(<i>channel</i>)
133 <p>
134 Private method to receive the response from the clients.
135 </p><dl>
136 <dt><i>channel</i></dt>
137 <dd>
138 of the incomming connection (int: 0 or 1)
139 </dd>
140 </dl><a NAME="BackgroundService.__send" ID="BackgroundService.__send"></a>
141 <h4>BackgroundService.__send</h4>
142 <b>__send</b>(<i>fx, fn, pyVer, data</i>)
143 <p>
144 Private method to send a job request to one of the clients.
145 </p><dl>
146 <dt><i>fx</i></dt>
147 <dd>
148 remote function name to execute (str)
149 </dd><dt><i>fn</i></dt>
150 <dd>
151 filename for identification (str)
152 </dd><dt><i>pyVer</i></dt>
153 <dd>
154 version for the required interpreter (int)
155 </dd><dt><i>data</i></dt>
156 <dd>
157 function argument(s) (any basic datatype)
158 </dd>
159 </dl><a NAME="BackgroundService.__startExternalClient" ID="BackgroundService.__startExternalClient"></a>
160 <h4>BackgroundService.__startExternalClient</h4>
161 <b>__startExternalClient</b>(<i>interpreter, port</i>)
162 <p>
163 Private method to start the background client as external process.
164 </p><dl>
165 <dt><i>interpreter</i></dt>
166 <dd>
167 path and name of the executable to start (string)
168 </dd><dt><i>port</i></dt>
169 <dd>
170 socket port to which the interpreter should connect (int)
171 </dd>
172 </dl><dl>
173 <dt>Returns:</dt>
174 <dd>
175 the process object (QProcess) or None
176 </dd>
177 </dl><a NAME="BackgroundService.__startInternalClient" ID="BackgroundService.__startInternalClient"></a>
178 <h4>BackgroundService.__startInternalClient</h4>
179 <b>__startInternalClient</b>(<i>port</i>)
180 <p>
181 Private method to start the background client as internal thread.
182 </p><dl>
183 <dt><i>port</i></dt>
184 <dd>
185 socket port to which the interpreter should connect (int)
186 </dd>
187 </dl><dl>
188 <dt>Returns:</dt>
189 <dd>
190 the thread object (Thread) or None
191 </dd>
192 </dl><a NAME="BackgroundService.enqueueRequest" ID="BackgroundService.enqueueRequest"></a>
193 <h4>BackgroundService.enqueueRequest</h4>
194 <b>enqueueRequest</b>(<i>fx, fn, pyVer, data</i>)
195 <p>
196 Implement a queued processing of incomming events.
197 </p><p>
198 Dublicate file checks update an older request to avoid overrun or
199 starving of the check.
200 </p><dl>
201 <dt><i>fx</i></dt>
202 <dd>
203 function name of the service (str)
204 </dd><dt><i>fn</i></dt>
205 <dd>
206 filename for identification (str)
207 </dd><dt><i>pyVer</i></dt>
208 <dd>
209 version for the required interpreter (int)
210 </dd><dt><i>data</i></dt>
211 <dd>
212 function argument(s) (any basic datatype)
213 </dd>
214 </dl><a NAME="BackgroundService.on_newConnection" ID="BackgroundService.on_newConnection"></a>
215 <h4>BackgroundService.on_newConnection</h4>
216 <b>on_newConnection</b>(<i></i>)
217 <p>
218 Slot for new incomming connections from the clients.
219 </p><a NAME="BackgroundService.serviceConnect" ID="BackgroundService.serviceConnect"></a>
220 <h4>BackgroundService.serviceConnect</h4>
221 <b>serviceConnect</b>(<i>fx, modulepath, module, callback, onErrorCallback=None</i>)
222 <p>
223 Announce a new service to the background service/ client.
224 </p><dl>
225 <dt><i>fx</i></dt>
226 <dd>
227 function name of the service (str)
228 </dd><dt><i>modulepath</i></dt>
229 <dd>
230 full path to the module (str)
231 </dd><dt><i>module</i></dt>
232 <dd>
233 name to import (str)
234 </dd><dt><i>callback</i></dt>
235 <dd>
236 function on service response (function)
237 </dd><dt><i>onErrorCallback</i></dt>
238 <dd>
239 function if client isn't available (function)
240 </dd>
241 </dl><a NAME="BackgroundService.serviceDisconnect" ID="BackgroundService.serviceDisconnect"></a>
242 <h4>BackgroundService.serviceDisconnect</h4>
243 <b>serviceDisconnect</b>(<i>fx</i>)
244 <p>
245 Remove the service from the service list.
246 </p><dl>
247 <dt><i>fx</i></dt>
248 <dd>
249 function name of the service
250 </dd>
251 </dl><a NAME="BackgroundService.shutdown" ID="BackgroundService.shutdown"></a>
252 <h4>BackgroundService.shutdown</h4>
253 <b>shutdown</b>(<i></i>)
254 <p>
255 Cleanup the connections and processes when Eric is shuting down.
256 </p>
257 <div align="right"><a href="#top">Up</a></div>
258 <hr />
259 </body></html>

eric ide

mercurial