|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Utilities.BackgroundClient</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.Utilities.BackgroundClient</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a Qt free version of a background client for the various |
|
13 checkers and other python interpreter dependent functions. |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 |
|
17 <table> |
|
18 <tr><td>None</td></tr> |
|
19 </table> |
|
20 <h3>Classes</h3> |
|
21 |
|
22 <table> |
|
23 |
|
24 <tr> |
|
25 <td><a href="#BackgroundClient">BackgroundClient</a></td> |
|
26 <td>Class implementing the main part of the background client.</td> |
|
27 </tr> |
|
28 </table> |
|
29 <h3>Functions</h3> |
|
30 |
|
31 <table> |
|
32 <tr><td>None</td></tr> |
|
33 </table> |
|
34 <hr /> |
|
35 <hr /> |
|
36 <a NAME="BackgroundClient" ID="BackgroundClient"></a> |
|
37 <h2>BackgroundClient</h2> |
|
38 |
|
39 <p> |
|
40 Class implementing the main part of the background client. |
|
41 </p> |
|
42 <h3>Derived from</h3> |
|
43 None |
|
44 <h3>Class Attributes</h3> |
|
45 |
|
46 <table> |
|
47 <tr><td>None</td></tr> |
|
48 </table> |
|
49 <h3>Class Methods</h3> |
|
50 |
|
51 <table> |
|
52 <tr><td>None</td></tr> |
|
53 </table> |
|
54 <h3>Methods</h3> |
|
55 |
|
56 <table> |
|
57 |
|
58 <tr> |
|
59 <td><a href="#BackgroundClient.__init__">BackgroundClient</a></td> |
|
60 <td>Constructor</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#BackgroundClient.__cancelled">__cancelled</a></td> |
|
64 <td>Private method to check for a job cancellation.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#BackgroundClient.__initClientService">__initClientService</a></td> |
|
68 <td>Private method to import the given module and register it as service.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#BackgroundClient.__peek">__peek</a></td> |
|
72 <td>Private method to peek the given length of bytes.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#BackgroundClient.__receive">__receive</a></td> |
|
76 <td>Private method to receive the given length of bytes.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#BackgroundClient.__send">__send</a></td> |
|
80 <td>Private method to send a job response back to the BackgroundService server.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#BackgroundClient.run">run</a></td> |
|
84 <td>Public method implementing the main loop of the client.</td> |
|
85 </tr> |
|
86 </table> |
|
87 <h3>Static Methods</h3> |
|
88 |
|
89 <table> |
|
90 <tr><td>None</td></tr> |
|
91 </table> |
|
92 |
|
93 <a NAME="BackgroundClient.__init__" ID="BackgroundClient.__init__"></a> |
|
94 <h4>BackgroundClient (Constructor)</h4> |
|
95 <b>BackgroundClient</b>(<i>host, port, maxProcs</i>) |
|
96 |
|
97 <p> |
|
98 Constructor |
|
99 </p> |
|
100 <dl> |
|
101 |
|
102 <dt><i>host</i> (str)</dt> |
|
103 <dd> |
|
104 ip address the background service is listening |
|
105 </dd> |
|
106 <dt><i>port</i> (int)</dt> |
|
107 <dd> |
|
108 port of the background service |
|
109 </dd> |
|
110 <dt><i>maxProcs</i> (int)</dt> |
|
111 <dd> |
|
112 maximum number of CPUs (processes) to use |
|
113 (0 = determined automatically) |
|
114 </dd> |
|
115 </dl> |
|
116 <a NAME="BackgroundClient.__cancelled" ID="BackgroundClient.__cancelled"></a> |
|
117 <h4>BackgroundClient.__cancelled</h4> |
|
118 <b>__cancelled</b>(<i></i>) |
|
119 |
|
120 <p> |
|
121 Private method to check for a job cancellation. |
|
122 </p> |
|
123 <dl> |
|
124 <dt>Return:</dt> |
|
125 <dd> |
|
126 flag indicating a cancellation |
|
127 </dd> |
|
128 </dl> |
|
129 <dl> |
|
130 <dt>Return Type:</dt> |
|
131 <dd> |
|
132 bool |
|
133 </dd> |
|
134 </dl> |
|
135 <a NAME="BackgroundClient.__initClientService" ID="BackgroundClient.__initClientService"></a> |
|
136 <h4>BackgroundClient.__initClientService</h4> |
|
137 <b>__initClientService</b>(<i>fn, path, module</i>) |
|
138 |
|
139 <p> |
|
140 Private method to import the given module and register it as service. |
|
141 </p> |
|
142 <dl> |
|
143 |
|
144 <dt><i>fn</i> (str)</dt> |
|
145 <dd> |
|
146 service name to register |
|
147 </dd> |
|
148 <dt><i>path</i> (str)</dt> |
|
149 <dd> |
|
150 contains the path to the module |
|
151 </dd> |
|
152 <dt><i>module</i> (str)</dt> |
|
153 <dd> |
|
154 name to import |
|
155 </dd> |
|
156 </dl> |
|
157 <dl> |
|
158 <dt>Return:</dt> |
|
159 <dd> |
|
160 text result of the import action |
|
161 </dd> |
|
162 </dl> |
|
163 <dl> |
|
164 <dt>Return Type:</dt> |
|
165 <dd> |
|
166 str |
|
167 </dd> |
|
168 </dl> |
|
169 <a NAME="BackgroundClient.__peek" ID="BackgroundClient.__peek"></a> |
|
170 <h4>BackgroundClient.__peek</h4> |
|
171 <b>__peek</b>(<i>length</i>) |
|
172 |
|
173 <p> |
|
174 Private method to peek the given length of bytes. |
|
175 </p> |
|
176 <dl> |
|
177 |
|
178 <dt><i>length</i> (int)</dt> |
|
179 <dd> |
|
180 bytes to receive |
|
181 </dd> |
|
182 </dl> |
|
183 <dl> |
|
184 <dt>Return:</dt> |
|
185 <dd> |
|
186 received bytes |
|
187 </dd> |
|
188 </dl> |
|
189 <dl> |
|
190 <dt>Return Type:</dt> |
|
191 <dd> |
|
192 bytes |
|
193 </dd> |
|
194 </dl> |
|
195 <a NAME="BackgroundClient.__receive" ID="BackgroundClient.__receive"></a> |
|
196 <h4>BackgroundClient.__receive</h4> |
|
197 <b>__receive</b>(<i>length</i>) |
|
198 |
|
199 <p> |
|
200 Private method to receive the given length of bytes. |
|
201 </p> |
|
202 <dl> |
|
203 |
|
204 <dt><i>length</i> (int)</dt> |
|
205 <dd> |
|
206 bytes to receive |
|
207 </dd> |
|
208 </dl> |
|
209 <dl> |
|
210 <dt>Return:</dt> |
|
211 <dd> |
|
212 received bytes or None if connection closed |
|
213 </dd> |
|
214 </dl> |
|
215 <dl> |
|
216 <dt>Return Type:</dt> |
|
217 <dd> |
|
218 bytes |
|
219 </dd> |
|
220 </dl> |
|
221 <a NAME="BackgroundClient.__send" ID="BackgroundClient.__send"></a> |
|
222 <h4>BackgroundClient.__send</h4> |
|
223 <b>__send</b>(<i>fx, fn, data</i>) |
|
224 |
|
225 <p> |
|
226 Private method to send a job response back to the BackgroundService |
|
227 server. |
|
228 </p> |
|
229 <dl> |
|
230 |
|
231 <dt><i>fx</i> (str)</dt> |
|
232 <dd> |
|
233 remote function name to execute |
|
234 </dd> |
|
235 <dt><i>fn</i> (str)</dt> |
|
236 <dd> |
|
237 filename for identification |
|
238 </dd> |
|
239 <dt><i>data</i> (any basic datatype)</dt> |
|
240 <dd> |
|
241 return value(s) |
|
242 </dd> |
|
243 </dl> |
|
244 <a NAME="BackgroundClient.run" ID="BackgroundClient.run"></a> |
|
245 <h4>BackgroundClient.run</h4> |
|
246 <b>run</b>(<i></i>) |
|
247 |
|
248 <p> |
|
249 Public method implementing the main loop of the client. |
|
250 </p> |
|
251 <dl> |
|
252 |
|
253 <dt>Raises <b>RuntimeError</b>:</dt> |
|
254 <dd> |
|
255 raised if hashes don't match |
|
256 </dd> |
|
257 </dl> |
|
258 <div align="right"><a href="#top">Up</a></div> |
|
259 <hr /> |
|
260 </body></html> |