aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/classes.html111
-rw-r--r--utils/timeutils.html42
2 files changed, 0 insertions, 153 deletions
diff --git a/utils/classes.html b/utils/classes.html
index af14fda..3c681f4 100644
--- a/utils/classes.html
+++ b/utils/classes.html
@@ -152,117 +152,6 @@
152<h1><code class="xref py py-mod docutils literal"><span class="pre">classes</span></code> &#8211; Utility Classes<a class="headerlink" href="#classes-utility-classes" title="Permalink to this headline">¶</a></h1> 152<h1><code class="xref py py-mod docutils literal"><span class="pre">classes</span></code> &#8211; Utility Classes<a class="headerlink" href="#classes-utility-classes" title="Permalink to this headline">¶</a></h1>
153<p>Defines some classes to use when implementing ZMQ devices</p> 153<p>Defines some classes to use when implementing ZMQ devices</p>
154<dl class="class"> 154<dl class="class">
155<dt id="eventmq.utils.classes.EMQPService">
156<em class="property">class </em><code class="descclassname">eventmq.utils.classes.</code><code class="descname">EMQPService</code><a class="headerlink" href="#eventmq.utils.classes.EMQPService" title="Permalink to this definition">¶</a></dt>
157<dd><p>Helper for devices that connect to brokers.</p>
158<p>Implements utility methods for sending EMQP messages for the following
159EMQP commands.</p>
160<blockquote>
161<div><ul class="simple">
162<li>INFORM</li>
163</ul>
164</div></blockquote>
165<p>Also implements utlitiy methods for managing long-running processes.</p>
166<dl class="docutils">
167<dt>To use you must define:</dt>
168<dd><ul class="first last simple">
169<li><cite>self.outgoing</cite> - socket where messages can be sent to the Router</li>
170<li><cite>self.SERVICE_TYPE</cite> - defines the service type for INFORM. See
171<a class="reference internal" href="#eventmq.utils.classes.EMQPService.send_inform" title="eventmq.utils.classes.EMQPService.send_inform"><code class="xref py py-meth docutils literal"><span class="pre">send_inform()</span></code></a> for more information.</li>
172<li><cite>self.poller</cite> - the poller that <cite>self.outgoing</cite> will be using.
173Usually: <cite>self.poller = eventmq.poller.Poller()</cite></li>
174</ul>
175</dd>
176</dl>
177<p>When messages are received from the router, they are processed in
178<a class="reference internal" href="#eventmq.utils.classes.EMQPService.process_message" title="eventmq.utils.classes.EMQPService.process_message"><code class="xref py py-meth docutils literal"><span class="pre">process_message()</span></code></a> which then calls <cite>on_COMMAND</cite>. This should be used
179in the event loop so if you want to respond to the SCHEDULE command, you
180would define the method <cite>on_schedule</cite> in your service class.</p>
181<p>See the code for <code class="xref py py-class docutils literal"><span class="pre">Scheduler</span></code> and <code class="xref py py-class docutils literal"><span class="pre">JobManager</span></code> for examples.</p>
182<dl class="attribute">
183<dt id="eventmq.utils.classes.EMQPService.__weakref__">
184<code class="descname">__weakref__</code><a class="headerlink" href="#eventmq.utils.classes.EMQPService.__weakref__" title="Permalink to this definition">¶</a></dt>
185<dd><p>list of weak references to the object (if defined)</p>
186</dd></dl>
187
188<dl class="attribute">
189<dt id="eventmq.utils.classes.EMQPService.is_heartbeat_enabled">
190<code class="descname">is_heartbeat_enabled</code><a class="headerlink" href="#eventmq.utils.classes.EMQPService.is_heartbeat_enabled" title="Permalink to this definition">¶</a></dt>
191<dd><p>Property to check if heartbeating is enabled. Useful when certain
192properties must be updated for heartbeating
193:returns: bool - True if heartbeating is enabled, False if it isn&#8217;t</p>
194</dd></dl>
195
196<dl class="method">
197<dt id="eventmq.utils.classes.EMQPService.on_ack">
198<code class="descname">on_ack</code><span class="sig-paren">(</span><em>msgid</em>, <em>ackd_msgid</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.EMQPService.on_ack" title="Permalink to this definition">¶</a></dt>
199<dd><p>Sets <code class="xref py py-attr docutils literal"><span class="pre">awaiting_ack</span></code> to False</p>
200</dd></dl>
201
202<dl class="method">
203<dt id="eventmq.utils.classes.EMQPService.process_message">
204<code class="descname">process_message</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.EMQPService.process_message" title="Permalink to this definition">¶</a></dt>
205<dd><p>Processes a message. Processing takes form of calling an
206<cite>on_EMQP_COMMAND</cite> method. The method must accept <cite>msgid</cite> and <cite>message</cite>
207as the first arguments.</p>
208<table class="docutils field-list" frame="void" rules="none">
209<col class="field-name" />
210<col class="field-body" />
211<tbody valign="top">
212<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>msg</strong> &#8211; The message received from the socket to parse and process.</td>
213</tr>
214</tbody>
215</table>
216</dd></dl>
217
218<dl class="method">
219<dt id="eventmq.utils.classes.EMQPService.reset">
220<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.EMQPService.reset" title="Permalink to this definition">¶</a></dt>
221<dd><p>Resets the current connection by closing and reopening the socket</p>
222</dd></dl>
223
224<dl class="method">
225<dt id="eventmq.utils.classes.EMQPService.send_inform">
226<code class="descname">send_inform</code><span class="sig-paren">(</span><em>queue=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.EMQPService.send_inform" title="Permalink to this definition">¶</a></dt>
227<dd><p>Queues an INFORM command to <cite>self.outgoing</cite>.</p>
228<table class="docutils field-list" frame="void" rules="none">
229<col class="field-name" />
230<col class="field-body" />
231<tbody valign="top">
232<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
233<li><strong>type</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Either &#8216;worker&#8217; or &#8216;scheduler&#8217;</li>
234<li><strong>queue</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; <ul>
235<li>For &#8216;worker&#8217; type, the queues the worker is listening on</li>
236<li>Ignored for &#8216;scheduler&#8217; type</li>
237</ul>
238</li>
239</ul>
240</td>
241</tr>
242<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> &#8211; When <cite>type_</cite> does not match a specified type</p>
243</td>
244</tr>
245</tbody>
246</table>
247</dd></dl>
248
249<dl class="method">
250<dt id="eventmq.utils.classes.EMQPService.start">
251<code class="descname">start</code><span class="sig-paren">(</span><em>addr</em>, <em>queues='default'</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.EMQPService.start" title="Permalink to this definition">¶</a></dt>
252<dd><p>Connect to <cite>addr</cite> and begin listening for job requests</p>
253<table class="docutils field-list" frame="void" rules="none">
254<col class="field-name" />
255<col class="field-body" />
256<tbody valign="top">
257<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>addr</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; connection string to connect to</td>
258</tr>
259</tbody>
260</table>
261</dd></dl>
262
263</dd></dl>
264
265<dl class="class">
266<dt id="eventmq.utils.classes.HeartbeatMixin"> 155<dt id="eventmq.utils.classes.HeartbeatMixin">
267<em class="property">class </em><code class="descclassname">eventmq.utils.classes.</code><code class="descname">HeartbeatMixin</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.HeartbeatMixin" title="Permalink to this definition">¶</a></dt> 156<em class="property">class </em><code class="descclassname">eventmq.utils.classes.</code><code class="descname">HeartbeatMixin</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.classes.HeartbeatMixin" title="Permalink to this definition">¶</a></dt>
268<dd><p>Provides methods for implementing heartbeats</p> 157<dd><p>Provides methods for implementing heartbeats</p>
diff --git a/utils/timeutils.html b/utils/timeutils.html
index 087322b..72b99ed 100644
--- a/utils/timeutils.html
+++ b/utils/timeutils.html
@@ -150,48 +150,6 @@
150 150
151 <span class="target" id="module-eventmq.utils.timeutils"></span><div class="section" id="timeutils-time-utilites"> 151 <span class="target" id="module-eventmq.utils.timeutils"></span><div class="section" id="timeutils-time-utilites">
152<h1><code class="xref py py-mod docutils literal"><span class="pre">timeutils</span></code> &#8211; Time Utilites<a class="headerlink" href="#timeutils-time-utilites" title="Permalink to this headline">¶</a></h1> 152<h1><code class="xref py py-mod docutils literal"><span class="pre">timeutils</span></code> &#8211; Time Utilites<a class="headerlink" href="#timeutils-time-utilites" title="Permalink to this headline">¶</a></h1>
153<dl class="class">
154<dt id="eventmq.utils.timeutils.IntervalIter">
155<em class="property">class </em><code class="descclassname">eventmq.utils.timeutils.</code><code class="descname">IntervalIter</code><span class="sig-paren">(</span><em>start_value</em>, <em>interval_secs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.timeutils.IntervalIter" title="Permalink to this definition">¶</a></dt>
156<dd><p>represents an interval (in seconds) and it&#8217;s <cite>next()</cite> execution time</p>
157<dl class="docutils">
158<dt>Usage:</dt>
159<dd><p class="first"># interval of 5min using monotonic clock (assume it starts at 0 for the
160# sake of the example)
161interval = IntervalIter(monotonic, 300)
162# Py2</p>
163<p>interval.next() # 300
164interval.next() # 600</p>
165<p class="last"># Py3
166next(interval) # 300
167next(interval) # 600</p>
168</dd>
169</dl>
170<dl class="method">
171<dt id="eventmq.utils.timeutils.IntervalIter.__init__">
172<code class="descname">__init__</code><span class="sig-paren">(</span><em>start_value</em>, <em>interval_secs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.timeutils.IntervalIter.__init__" title="Permalink to this definition">¶</a></dt>
173<dd><table class="docutils field-list" frame="void" rules="none">
174<col class="field-name" />
175<col class="field-body" />
176<tbody valign="top">
177<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
178<li><strong>start_value</strong> (<em>numeric</em>) &#8211; via <a class="reference internal" href="#eventmq.utils.timeutils.monotonic" title="eventmq.utils.timeutils.monotonic"><code class="xref py py-func docutils literal"><span class="pre">monotonic()</span></code></a> or <a class="reference internal" href="#eventmq.utils.timeutils.timestamp" title="eventmq.utils.timeutils.timestamp"><code class="xref py py-func docutils literal"><span class="pre">timestamp()</span></code></a></li>
179<li><strong>interval_secs</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; </li>
180</ul>
181</td>
182</tr>
183</tbody>
184</table>
185</dd></dl>
186
187<dl class="attribute">
188<dt id="eventmq.utils.timeutils.IntervalIter.__weakref__">
189<code class="descname">__weakref__</code><a class="headerlink" href="#eventmq.utils.timeutils.IntervalIter.__weakref__" title="Permalink to this definition">¶</a></dt>
190<dd><p>list of weak references to the object (if defined)</p>
191</dd></dl>
192
193</dd></dl>
194
195<dl class="function"> 153<dl class="function">
196<dt id="eventmq.utils.timeutils.monotonic"> 154<dt id="eventmq.utils.timeutils.monotonic">
197<code class="descclassname">eventmq.utils.timeutils.</code><code class="descname">monotonic</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.timeutils.monotonic" title="Permalink to this definition">¶</a></dt> 155<code class="descclassname">eventmq.utils.timeutils.</code><code class="descname">monotonic</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.utils.timeutils.monotonic" title="Permalink to this definition">¶</a></dt>