|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Utilities.BackgroundClient</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.BackgroundClient</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing a Qt free version of a background client for the various |
|
27 checkers and other 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="#BackgroundClient">BackgroundClient</a></td> |
|
40 <td>Class implementing the main part of the background client.</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="BackgroundClient" ID="BackgroundClient"></a> |
|
51 <h2>BackgroundClient</h2> |
|
52 |
|
53 <p> |
|
54 Class implementing the main part of the background client. |
|
55 </p> |
|
56 <h3>Derived from</h3> |
|
57 None |
|
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="#BackgroundClient.__init__">BackgroundClient</a></td> |
|
74 <td>Constructor</td> |
|
75 </tr> |
|
76 <tr> |
|
77 <td><a href="#BackgroundClient.__cancelled">__cancelled</a></td> |
|
78 <td>Private method to check for a job cancellation.</td> |
|
79 </tr> |
|
80 <tr> |
|
81 <td><a href="#BackgroundClient.__initClientService">__initClientService</a></td> |
|
82 <td>Private method to import the given module and register it as service.</td> |
|
83 </tr> |
|
84 <tr> |
|
85 <td><a href="#BackgroundClient.__peek">__peek</a></td> |
|
86 <td>Private method to peek the given length of bytes.</td> |
|
87 </tr> |
|
88 <tr> |
|
89 <td><a href="#BackgroundClient.__receive">__receive</a></td> |
|
90 <td>Private method to receive the given length of bytes.</td> |
|
91 </tr> |
|
92 <tr> |
|
93 <td><a href="#BackgroundClient.__send">__send</a></td> |
|
94 <td>Private method to send a job response back to the BackgroundService server.</td> |
|
95 </tr> |
|
96 <tr> |
|
97 <td><a href="#BackgroundClient.run">run</a></td> |
|
98 <td>Public method implementing the main loop of the client.</td> |
|
99 </tr> |
|
100 </table> |
|
101 <h3>Static Methods</h3> |
|
102 |
|
103 <table> |
|
104 <tr><td>None</td></tr> |
|
105 </table> |
|
106 |
|
107 <a NAME="BackgroundClient.__init__" ID="BackgroundClient.__init__"></a> |
|
108 <h4>BackgroundClient (Constructor)</h4> |
|
109 <b>BackgroundClient</b>(<i>host, port, maxProcs</i>) |
|
110 |
|
111 <p> |
|
112 Constructor |
|
113 </p> |
|
114 <dl> |
|
115 |
|
116 <dt><i>host</i> (str)</dt> |
|
117 <dd> |
|
118 ip address the background service is listening |
|
119 </dd> |
|
120 <dt><i>port</i> (int)</dt> |
|
121 <dd> |
|
122 port of the background service |
|
123 </dd> |
|
124 <dt><i>maxProcs</i> (int)</dt> |
|
125 <dd> |
|
126 maximum number of CPUs (processes) to use |
|
127 (0 = determined automatically) |
|
128 </dd> |
|
129 </dl> |
|
130 <a NAME="BackgroundClient.__cancelled" ID="BackgroundClient.__cancelled"></a> |
|
131 <h4>BackgroundClient.__cancelled</h4> |
|
132 <b>__cancelled</b>(<i></i>) |
|
133 |
|
134 <p> |
|
135 Private method to check for a job cancellation. |
|
136 </p> |
|
137 <dl> |
|
138 <dt>Return:</dt> |
|
139 <dd> |
|
140 flag indicating a cancellation |
|
141 </dd> |
|
142 </dl> |
|
143 <dl> |
|
144 <dt>Return Type:</dt> |
|
145 <dd> |
|
146 bool |
|
147 </dd> |
|
148 </dl> |
|
149 <a NAME="BackgroundClient.__initClientService" ID="BackgroundClient.__initClientService"></a> |
|
150 <h4>BackgroundClient.__initClientService</h4> |
|
151 <b>__initClientService</b>(<i>fn, path, module</i>) |
|
152 |
|
153 <p> |
|
154 Private method to import the given module and register it as service. |
|
155 </p> |
|
156 <dl> |
|
157 |
|
158 <dt><i>fn</i> (str)</dt> |
|
159 <dd> |
|
160 service name to register |
|
161 </dd> |
|
162 <dt><i>path</i> (str)</dt> |
|
163 <dd> |
|
164 contains the path to the module |
|
165 </dd> |
|
166 <dt><i>module</i> (str)</dt> |
|
167 <dd> |
|
168 name to import |
|
169 </dd> |
|
170 </dl> |
|
171 <dl> |
|
172 <dt>Return:</dt> |
|
173 <dd> |
|
174 text result of the import action |
|
175 </dd> |
|
176 </dl> |
|
177 <dl> |
|
178 <dt>Return Type:</dt> |
|
179 <dd> |
|
180 str |
|
181 </dd> |
|
182 </dl> |
|
183 <a NAME="BackgroundClient.__peek" ID="BackgroundClient.__peek"></a> |
|
184 <h4>BackgroundClient.__peek</h4> |
|
185 <b>__peek</b>(<i>length</i>) |
|
186 |
|
187 <p> |
|
188 Private method to peek the given length of bytes. |
|
189 </p> |
|
190 <dl> |
|
191 |
|
192 <dt><i>length</i> (int)</dt> |
|
193 <dd> |
|
194 bytes to receive |
|
195 </dd> |
|
196 </dl> |
|
197 <dl> |
|
198 <dt>Return:</dt> |
|
199 <dd> |
|
200 received bytes |
|
201 </dd> |
|
202 </dl> |
|
203 <dl> |
|
204 <dt>Return Type:</dt> |
|
205 <dd> |
|
206 bytes |
|
207 </dd> |
|
208 </dl> |
|
209 <a NAME="BackgroundClient.__receive" ID="BackgroundClient.__receive"></a> |
|
210 <h4>BackgroundClient.__receive</h4> |
|
211 <b>__receive</b>(<i>length</i>) |
|
212 |
|
213 <p> |
|
214 Private method to receive the given length of bytes. |
|
215 </p> |
|
216 <dl> |
|
217 |
|
218 <dt><i>length</i> (int)</dt> |
|
219 <dd> |
|
220 bytes to receive |
|
221 </dd> |
|
222 </dl> |
|
223 <dl> |
|
224 <dt>Return:</dt> |
|
225 <dd> |
|
226 received bytes or None if connection closed |
|
227 </dd> |
|
228 </dl> |
|
229 <dl> |
|
230 <dt>Return Type:</dt> |
|
231 <dd> |
|
232 bytes |
|
233 </dd> |
|
234 </dl> |
|
235 <a NAME="BackgroundClient.__send" ID="BackgroundClient.__send"></a> |
|
236 <h4>BackgroundClient.__send</h4> |
|
237 <b>__send</b>(<i>fx, fn, data</i>) |
|
238 |
|
239 <p> |
|
240 Private method to send a job response back to the BackgroundService |
|
241 server. |
|
242 </p> |
|
243 <dl> |
|
244 |
|
245 <dt><i>fx</i> (str)</dt> |
|
246 <dd> |
|
247 remote function name to execute |
|
248 </dd> |
|
249 <dt><i>fn</i> (str)</dt> |
|
250 <dd> |
|
251 filename for identification |
|
252 </dd> |
|
253 <dt><i>data</i> (any basic datatype)</dt> |
|
254 <dd> |
|
255 return value(s) |
|
256 </dd> |
|
257 </dl> |
|
258 <a NAME="BackgroundClient.run" ID="BackgroundClient.run"></a> |
|
259 <h4>BackgroundClient.run</h4> |
|
260 <b>run</b>(<i></i>) |
|
261 |
|
262 <p> |
|
263 Public method implementing the main loop of the client. |
|
264 </p> |
|
265 <dl> |
|
266 |
|
267 <dt>Raises <b>RuntimeError</b>:</dt> |
|
268 <dd> |
|
269 raised if hashes don't match |
|
270 </dd> |
|
271 </dl> |
|
272 <div align="right"><a href="#top">Up</a></div> |
|
273 <hr /> |
|
274 </body></html> |