|
1 |
|
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
4 |
|
5 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
6 <head> |
|
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
8 <title>pyams_zmq package — PyAMS User Guide 0.1.0 documentation</title> |
|
9 <link rel="stylesheet" href="_static/pyramid.css" type="text/css" /> |
|
10 <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> |
|
11 <script type="text/javascript"> |
|
12 var DOCUMENTATION_OPTIONS = { |
|
13 URL_ROOT: './', |
|
14 VERSION: '0.1.0', |
|
15 COLLAPSE_INDEX: false, |
|
16 FILE_SUFFIX: '.html', |
|
17 HAS_SOURCE: true, |
|
18 SOURCELINK_SUFFIX: '.txt' |
|
19 }; |
|
20 </script> |
|
21 <script type="text/javascript" src="_static/jquery.js"></script> |
|
22 <script type="text/javascript" src="_static/underscore.js"></script> |
|
23 <script type="text/javascript" src="_static/doctools.js"></script> |
|
24 <link rel="index" title="Index" href="genindex.html" /> |
|
25 <link rel="search" title="Search" href="search.html" /> |
|
26 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&subset=latin" type="text/css" media="screen" charset="utf-8" /> |
|
27 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&subset=latin" type="text/css" media="screen" charset="utf-8" /> |
|
28 <!--[if lte IE 6]> |
|
29 <link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" /> |
|
30 <![endif]--> |
|
31 |
|
32 </head> |
|
33 <body> |
|
34 |
|
35 <div class="related" role="navigation" aria-label="related navigation"> |
|
36 <h3>Navigation</h3> |
|
37 <ul> |
|
38 <li class="right" style="margin-right: 10px"> |
|
39 <a href="genindex.html" title="General Index" |
|
40 accesskey="I">index</a></li> |
|
41 <li class="right" > |
|
42 <a href="py-modindex.html" title="Python Module Index" |
|
43 >modules</a> |</li> |
|
44 <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> »</li> |
|
45 </ul> |
|
46 </div> |
|
47 |
|
48 <div class="document"> |
|
49 <div class="documentwrapper"> |
|
50 <div class="bodywrapper"> |
|
51 <div class="body" role="main"> |
|
52 |
|
53 <div class="section" id="pyams-zmq-package"> |
|
54 <h1>pyams_zmq package<a class="headerlink" href="#pyams-zmq-package" title="Permalink to this headline">¶</a></h1> |
|
55 <div class="section" id="subpackages"> |
|
56 <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2> |
|
57 <div class="toctree-wrapper compound"> |
|
58 <ul> |
|
59 <li class="toctree-l1"><a class="reference internal" href="pyams_zmq.interfaces.html">pyams_zmq.interfaces package</a><ul> |
|
60 <li class="toctree-l2"><a class="reference internal" href="pyams_zmq.interfaces.html#module-pyams_zmq.interfaces">Module contents</a></li> |
|
61 </ul> |
|
62 </li> |
|
63 <li class="toctree-l1"><a class="reference internal" href="pyams_zmq.tests.html">pyams_zmq.tests package</a><ul> |
|
64 <li class="toctree-l2"><a class="reference internal" href="pyams_zmq.tests.html#submodules">Submodules</a></li> |
|
65 <li class="toctree-l2"><a class="reference internal" href="pyams_zmq.tests.html#module-pyams_zmq.tests.test_utilsdocs">pyams_zmq.tests.test_utilsdocs module</a></li> |
|
66 <li class="toctree-l2"><a class="reference internal" href="pyams_zmq.tests.html#module-pyams_zmq.tests.test_utilsdocstrings">pyams_zmq.tests.test_utilsdocstrings module</a></li> |
|
67 <li class="toctree-l2"><a class="reference internal" href="pyams_zmq.tests.html#module-pyams_zmq.tests">Module contents</a></li> |
|
68 </ul> |
|
69 </li> |
|
70 </ul> |
|
71 </div> |
|
72 </div> |
|
73 <div class="section" id="submodules"> |
|
74 <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2> |
|
75 </div> |
|
76 <div class="section" id="module-pyams_zmq.handler"> |
|
77 <span id="pyams-zmq-handler-module"></span><h2>pyams_zmq.handler module<a class="headerlink" href="#module-pyams_zmq.handler" title="Permalink to this headline">¶</a></h2> |
|
78 <dl class="class"> |
|
79 <dt id="pyams_zmq.handler.ZMQMessageHandler"> |
|
80 <em class="property">class </em><code class="descclassname">pyams_zmq.handler.</code><code class="descname">ZMQMessageHandler</code><span class="sig-paren">(</span><em>process</em>, <em>stream</em>, <em>stop</em>, <em>handler=None</em>, <em>json_load=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.handler.ZMQMessageHandler" title="Permalink to this definition">¶</a></dt> |
|
81 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p> |
|
82 <p>Base class for message handlers for a <code class="xref py py-class docutils literal"><span class="pre">pyams_zmq.process.Process</span></code>.</p> |
|
83 <p>Inheriting classes only need to implement a handler function for each |
|
84 message type.</p> |
|
85 <dl class="attribute"> |
|
86 <dt id="pyams_zmq.handler.ZMQMessageHandler.handler"> |
|
87 <code class="descname">handler</code><em class="property"> = None</em><a class="headerlink" href="#pyams_zmq.handler.ZMQMessageHandler.handler" title="Permalink to this definition">¶</a></dt> |
|
88 <dd></dd></dl> |
|
89 |
|
90 </dd></dl> |
|
91 |
|
92 </div> |
|
93 <div class="section" id="module-pyams_zmq.process"> |
|
94 <span id="pyams-zmq-process-module"></span><h2>pyams_zmq.process module<a class="headerlink" href="#module-pyams_zmq.process" title="Permalink to this headline">¶</a></h2> |
|
95 <dl class="class"> |
|
96 <dt id="pyams_zmq.process.ZMQProcess"> |
|
97 <em class="property">class </em><code class="descclassname">pyams_zmq.process.</code><code class="descname">ZMQProcess</code><span class="sig-paren">(</span><em>bind_addr</em>, <em>handler</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess" title="Permalink to this definition">¶</a></dt> |
|
98 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">multiprocessing.context.Process</span></code></p> |
|
99 <p>This is the base for all processes and offers utility methods |
|
100 for setup and creating new streams.</p> |
|
101 <dl class="attribute"> |
|
102 <dt id="pyams_zmq.process.ZMQProcess.context"> |
|
103 <code class="descname">context</code><em class="property"> = None</em><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.context" title="Permalink to this definition">¶</a></dt> |
|
104 <dd><p>The ØMQ <code class="xref py py-class docutils literal"><span class="pre">Context</span></code> instance.</p> |
|
105 </dd></dl> |
|
106 |
|
107 <dl class="method"> |
|
108 <dt id="pyams_zmq.process.ZMQProcess.exit"> |
|
109 <code class="descname">exit</code><span class="sig-paren">(</span><em>num</em>, <em>frame</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.exit" title="Permalink to this definition">¶</a></dt> |
|
110 <dd></dd></dl> |
|
111 |
|
112 <dl class="method"> |
|
113 <dt id="pyams_zmq.process.ZMQProcess.initStream"> |
|
114 <code class="descname">initStream</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.initStream" title="Permalink to this definition">¶</a></dt> |
|
115 <dd><p>Initialize response stream</p> |
|
116 </dd></dl> |
|
117 |
|
118 <dl class="attribute"> |
|
119 <dt id="pyams_zmq.process.ZMQProcess.loop"> |
|
120 <code class="descname">loop</code><em class="property"> = None</em><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.loop" title="Permalink to this definition">¶</a></dt> |
|
121 <dd><p>PyZMQ’s event loop (<code class="xref py py-class docutils literal"><span class="pre">IOLoop</span></code>).</p> |
|
122 </dd></dl> |
|
123 |
|
124 <dl class="method"> |
|
125 <dt id="pyams_zmq.process.ZMQProcess.run"> |
|
126 <code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.run" title="Permalink to this definition">¶</a></dt> |
|
127 <dd><p>Sets up everything and starts the event loop.</p> |
|
128 </dd></dl> |
|
129 |
|
130 <dl class="method"> |
|
131 <dt id="pyams_zmq.process.ZMQProcess.setup"> |
|
132 <code class="descname">setup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.setup" title="Permalink to this definition">¶</a></dt> |
|
133 <dd><p>Creates a <a class="reference internal" href="#pyams_zmq.process.ZMQProcess.context" title="pyams_zmq.process.ZMQProcess.context"><code class="xref py py-attr docutils literal"><span class="pre">context</span></code></a> and an event <a class="reference internal" href="#pyams_zmq.process.ZMQProcess.loop" title="pyams_zmq.process.ZMQProcess.loop"><code class="xref py py-attr docutils literal"><span class="pre">loop</span></code></a> for the process.</p> |
|
134 </dd></dl> |
|
135 |
|
136 <dl class="attribute"> |
|
137 <dt id="pyams_zmq.process.ZMQProcess.socket_type"> |
|
138 <code class="descname">socket_type</code><em class="property"> = 4</em><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.socket_type" title="Permalink to this definition">¶</a></dt> |
|
139 <dd></dd></dl> |
|
140 |
|
141 <dl class="method"> |
|
142 <dt id="pyams_zmq.process.ZMQProcess.stop"> |
|
143 <code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.stop" title="Permalink to this definition">¶</a></dt> |
|
144 <dd><p>Stops the event loop.</p> |
|
145 </dd></dl> |
|
146 |
|
147 <dl class="method"> |
|
148 <dt id="pyams_zmq.process.ZMQProcess.stream"> |
|
149 <code class="descname">stream</code><span class="sig-paren">(</span><em>sock_type</em>, <em>addr</em>, <em>bind</em>, <em>callback=None</em>, <em>subscribe=b''</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.ZMQProcess.stream" title="Permalink to this definition">¶</a></dt> |
|
150 <dd><p>Creates a <code class="xref py py-class docutils literal"><span class="pre">ZMQStream</span></code>.</p> |
|
151 <table class="docutils field-list" frame="void" rules="none"> |
|
152 <col class="field-name" /> |
|
153 <col class="field-body" /> |
|
154 <tbody valign="top"> |
|
155 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
|
156 <li><strong>sock_type</strong> – The ØMQ socket type (e.g. <code class="docutils literal"><span class="pre">zmq.REQ</span></code>)</li> |
|
157 <li><strong>addr</strong> – <p>Address to bind or connect to formatted as <em>host:port</em>, |
|
158 <em>(host, port)</em> or <em>host</em> (bind to random port). |
|
159 If <em>bind</em> is <code class="docutils literal"><span class="pre">True</span></code>, <em>host</em> may be:</p> |
|
160 <ul> |
|
161 <li>the wild-card <code class="docutils literal"><span class="pre">*</span></code>, meaning all available interfaces,</li> |
|
162 <li>the primary IPv4 address assigned to the interface, in its</li> |
|
163 </ul> |
|
164 <p>numeric representation or |
|
165 - the interface name as defined by the operating system.</p> |
|
166 <p>If <em>bind</em> is <code class="docutils literal"><span class="pre">False</span></code>, <em>host</em> may be:</p> |
|
167 <ul> |
|
168 <li>the DNS name of the peer or</li> |
|
169 <li>the IPv4 address of the peer, in its numeric representation.</li> |
|
170 </ul> |
|
171 <p>If <em>addr</em> is just a host name without a port and <em>bind</em> is |
|
172 <code class="docutils literal"><span class="pre">True</span></code>, the socket will be bound to a random port.</p> |
|
173 </li> |
|
174 <li><strong>bind</strong> – Binds to <em>addr</em> if <code class="docutils literal"><span class="pre">True</span></code> or tries to connect to it |
|
175 otherwise.</li> |
|
176 <li><strong>callback</strong> – A callback for |
|
177 <code class="xref py py-meth docutils literal"><span class="pre">on_recv()</span></code>, optional</li> |
|
178 <li><strong>subscribe</strong> – Subscription pattern for <em>SUB</em> sockets, optional, |
|
179 defaults to <code class="docutils literal"><span class="pre">b''</span></code>.</li> |
|
180 </ul> |
|
181 </td> |
|
182 </tr> |
|
183 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A tuple containg the stream and the port number.</p> |
|
184 </td> |
|
185 </tr> |
|
186 </tbody> |
|
187 </table> |
|
188 </dd></dl> |
|
189 |
|
190 </dd></dl> |
|
191 |
|
192 <dl class="function"> |
|
193 <dt id="pyams_zmq.process.process_exit_func"> |
|
194 <code class="descclassname">pyams_zmq.process.</code><code class="descname">process_exit_func</code><span class="sig-paren">(</span><em>process=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.process.process_exit_func" title="Permalink to this definition">¶</a></dt> |
|
195 <dd></dd></dl> |
|
196 |
|
197 </div> |
|
198 <div class="section" id="module-pyams_zmq.socket"> |
|
199 <span id="pyams-zmq-socket-module"></span><h2>pyams_zmq.socket module<a class="headerlink" href="#module-pyams_zmq.socket" title="Permalink to this headline">¶</a></h2> |
|
200 <dl class="function"> |
|
201 <dt id="pyams_zmq.socket.zmq_response"> |
|
202 <code class="descclassname">pyams_zmq.socket.</code><code class="descname">zmq_response</code><span class="sig-paren">(</span><em>socket</em>, <em>flags=1</em>, <em>timeout=10</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.socket.zmq_response" title="Permalink to this definition">¶</a></dt> |
|
203 <dd><p>Get response from given socket</p> |
|
204 </dd></dl> |
|
205 |
|
206 <dl class="function"> |
|
207 <dt id="pyams_zmq.socket.zmq_socket"> |
|
208 <code class="descclassname">pyams_zmq.socket.</code><code class="descname">zmq_socket</code><span class="sig-paren">(</span><em>address</em>, <em>socket_type=3</em>, <em>linger=0</em>, <em>protocol='tcp'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.socket.zmq_socket" title="Permalink to this definition">¶</a></dt> |
|
209 <dd><p>Get ØMQ socket</p> |
|
210 </dd></dl> |
|
211 |
|
212 </div> |
|
213 <div class="section" id="module-pyams_zmq"> |
|
214 <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyams_zmq" title="Permalink to this headline">¶</a></h2> |
|
215 <dl class="function"> |
|
216 <dt id="pyams_zmq.includeme"> |
|
217 <code class="descclassname">pyams_zmq.</code><code class="descname">includeme</code><span class="sig-paren">(</span><em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_zmq.includeme" title="Permalink to this definition">¶</a></dt> |
|
218 <dd><p>Pyramid include</p> |
|
219 </dd></dl> |
|
220 |
|
221 </div> |
|
222 </div> |
|
223 |
|
224 |
|
225 </div> |
|
226 </div> |
|
227 </div> |
|
228 <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
|
229 <div class="sphinxsidebarwrapper"> |
|
230 <h3><a href="index.html">Table Of Contents</a></h3> |
|
231 <ul> |
|
232 <li><a class="reference internal" href="#">pyams_zmq package</a><ul> |
|
233 <li><a class="reference internal" href="#subpackages">Subpackages</a></li> |
|
234 <li><a class="reference internal" href="#submodules">Submodules</a></li> |
|
235 <li><a class="reference internal" href="#module-pyams_zmq.handler">pyams_zmq.handler module</a></li> |
|
236 <li><a class="reference internal" href="#module-pyams_zmq.process">pyams_zmq.process module</a></li> |
|
237 <li><a class="reference internal" href="#module-pyams_zmq.socket">pyams_zmq.socket module</a></li> |
|
238 <li><a class="reference internal" href="#module-pyams_zmq">Module contents</a></li> |
|
239 </ul> |
|
240 </li> |
|
241 </ul> |
|
242 |
|
243 <div id="searchbox" style="display: none" role="search"> |
|
244 <h3>Quick search</h3> |
|
245 <form class="search" action="search.html" method="get"> |
|
246 <div><input type="text" name="q" /></div> |
|
247 <div><input type="submit" value="Go" /></div> |
|
248 <input type="hidden" name="check_keywords" value="yes" /> |
|
249 <input type="hidden" name="area" value="default" /> |
|
250 </form> |
|
251 </div> |
|
252 <script type="text/javascript">$('#searchbox').show(0);</script> |
|
253 </div> |
|
254 </div> |
|
255 <div class="clearer"></div> |
|
256 </div> |
|
257 <div class="related" role="navigation" aria-label="related navigation"> |
|
258 <h3>Navigation</h3> |
|
259 <ul> |
|
260 <li class="right" style="margin-right: 10px"> |
|
261 <a href="genindex.html" title="General Index" |
|
262 >index</a></li> |
|
263 <li class="right" > |
|
264 <a href="py-modindex.html" title="Python Module Index" |
|
265 >modules</a> |</li> |
|
266 <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> »</li> |
|
267 </ul> |
|
268 </div> |
|
269 <div class="footer" role="contentinfo"> |
|
270 © Copyright 2017, Thierry Florac. |
|
271 Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5. |
|
272 </div> |
|
273 </body> |
|
274 </html> |