aboutsummaryrefslogtreecommitdiffstats
path: root/router.html
diff options
context:
space:
mode:
Diffstat (limited to 'router.html')
-rw-r--r--router.html75
1 files changed, 63 insertions, 12 deletions
diff --git a/router.html b/router.html
index a98b4c3..1cacb79 100644
--- a/router.html
+++ b/router.html
@@ -149,7 +149,7 @@
149<dd><p>A simple router of messages</p> 149<dd><p>A simple router of messages</p>
150<dl class="method"> 150<dl class="method">
151<dt id="eventmq.router.Router.add_worker"> 151<dt id="eventmq.router.Router.add_worker">
152<code class="descname">add_worker</code><span class="sig-paren">(</span><em>id</em>, <em>queues=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.add_worker" title="Permalink to this definition">¶</a></dt> 152<code class="descname">add_worker</code><span class="sig-paren">(</span><em>worker_id</em>, <em>queues=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.add_worker" title="Permalink to this definition">¶</a></dt>
153<dd><p>Adds a worker to worker queues</p> 153<dd><p>Adds a worker to worker queues</p>
154<table class="docutils field-list" frame="void" rules="none"> 154<table class="docutils field-list" frame="void" rules="none">
155<col class="field-name" /> 155<col class="field-name" />
@@ -175,15 +175,35 @@ responded in HEARTBEAT_TIMEOUT</p>
175<dl class="method"> 175<dl class="method">
176<dt id="eventmq.router.Router.on_heartbeat"> 176<dt id="eventmq.router.Router.on_heartbeat">
177<code class="descname">on_heartbeat</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_heartbeat" title="Permalink to this definition">¶</a></dt> 177<code class="descname">on_heartbeat</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_heartbeat" title="Permalink to this definition">¶</a></dt>
178<dd><p>a placeholder for a noop command. The actual &#8216;logic&#8217; for HEARTBEAT is 178<dd><p>a placeholder for a no-op command. The actual &#8216;logic&#8217; for HEARTBEAT is
179in <code class="xref py py-meth docutils literal"><span class="pre">self.process_worker_message()</span></code> because any message from a worker 179in <code class="xref py py-meth docutils literal"><span class="pre">self.process_worker_message()</span></code> because any message from a
180counts as a HEARTBEAT</p> 180worker counts as a HEARTBEAT</p>
181</dd></dl> 181</dd></dl>
182 182
183<dl class="method"> 183<dl class="method">
184<dt id="eventmq.router.Router.on_inform"> 184<dt id="eventmq.router.Router.on_inform">
185<code class="descname">on_inform</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_inform" title="Permalink to this definition">¶</a></dt> 185<code class="descname">on_inform</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_inform" title="Permalink to this definition">¶</a></dt>
186<dd><p>Handles an INFORM message. Usually when new worker coming online</p> 186<dd><p>Handles an INFORM message. This happens when new worker coming online
187and announces itself.</p>
188</dd></dl>
189
190<dl class="method">
191<dt id="eventmq.router.Router.on_ready">
192<code class="descname">on_ready</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_ready" title="Permalink to this definition">¶</a></dt>
193<dd><p>A worker that we should already know about is ready for another job</p>
194<table class="docutils field-list" frame="void" rules="none">
195<col class="field-name" />
196<col class="field-body" />
197<tbody valign="top">
198<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
199<li><strong>sender</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; The id of the sender</li>
200<li><strong>msgid</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Unique identifier for this message</li>
201<li><strong>msg</strong> &#8211; The actual message that was sent</li>
202</ul>
203</td>
204</tr>
205</tbody>
206</table>
187</dd></dl> 207</dd></dl>
188 208
189<dl class="method"> 209<dl class="method">
@@ -192,24 +212,55 @@ counts as a HEARTBEAT</p>
192<dd><p>This function is called when a message comes in from the client socket. 212<dd><p>This function is called when a message comes in from the client socket.
193It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a 213It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a
194warning is created.</p> 214warning is created.</p>
215<table class="docutils field-list" frame="void" rules="none">
216<col class="field-name" />
217<col class="field-body" />
218<tbody valign="top">
219<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>msg</strong> &#8211; The untouched message from zmq</td>
220</tr>
221</tbody>
222</table>
195</dd></dl> 223</dd></dl>
196 224
197<dl class="method"> 225<dl class="method">
198<dt id="eventmq.router.Router.process_worker_message"> 226<dt id="eventmq.router.Router.process_worker_message">
199<code class="descname">process_worker_message</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.process_worker_message" title="Permalink to this definition">¶</a></dt> 227<code class="descname">process_worker_message</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.process_worker_message" title="Permalink to this definition">¶</a></dt>
200<dd><p>This method is called when a message comes in from the worker socket. 228<dd><p>This method is called when a message comes in from the worker socket.
201It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a warning 229It then calls <cite>on_COMMAND.lower()</cite>. If <cite>on_command</cite> isn&#8217;t found, then
202is created.</p> 230a warning is created.</p>
203<dl class="docutils"> 231<table class="docutils field-list" frame="void" rules="none">
204<dt>def on_inform(msg):</dt> 232<col class="field-name" />
205<dd>pass</dd> 233<col class="field-body" />
206</dl> 234<tbody valign="top">
235<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>msg</strong> &#8211; The untouched message from zmq</td>
236</tr>
237</tbody>
238</table>
239</dd></dl>
240
241<dl class="method">
242<dt id="eventmq.router.Router.requeue_worker">
243<code class="descname">requeue_worker</code><span class="sig-paren">(</span><em>worker_id</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.requeue_worker" title="Permalink to this definition">¶</a></dt>
244<dd><p>Add a worker back to the queue pool</p>
207</dd></dl> 245</dd></dl>
208 246
209<dl class="method"> 247<dl class="method">
210<dt id="eventmq.router.Router.send_ack"> 248<dt id="eventmq.router.Router.send_ack">
211<code class="descname">send_ack</code><span class="sig-paren">(</span><em>socket</em>, <em>recipient</em>, <em>msgid</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_ack" title="Permalink to this definition">¶</a></dt> 249<code class="descname">send_ack</code><span class="sig-paren">(</span><em>socket</em>, <em>recipient</em>, <em>msgid</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_ack" title="Permalink to this definition">¶</a></dt>
212<dd><p>Sends an ACK response</p> 250<dd><p>Sends an ACK response</p>
251<table class="docutils field-list" frame="void" rules="none">
252<col class="field-name" />
253<col class="field-body" />
254<tbody valign="top">
255<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
256<li><strong>socket</strong> (<a class="reference external" href="https://docs.python.org/library/socket.html#module-socket" title="(in Python v2.7)"><em>socket</em></a>) &#8211; The socket to use for this ack</li>
257<li><strong>recipient</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; The recipient id for the ack</li>
258<li><strong>msgid</strong> &#8211; The unique id that we are acknowledging</li>
259</ul>
260</td>
261</tr>
262</tbody>
263</table>
213</dd></dl> 264</dd></dl>
214 265
215<dl class="method"> 266<dl class="method">
@@ -234,7 +285,7 @@ needed when building messages</p>
234<dl class="method"> 285<dl class="method">
235<dt id="eventmq.router.Router.send_workers_heartbeats"> 286<dt id="eventmq.router.Router.send_workers_heartbeats">
236<code class="descname">send_workers_heartbeats</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_workers_heartbeats" title="Permalink to this definition">¶</a></dt> 287<code class="descname">send_workers_heartbeats</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_workers_heartbeats" title="Permalink to this definition">¶</a></dt>
237<dd><p>Send heartbeats to the registered workers.</p> 288<dd><p>Send heartbeats to all registered workers.</p>
238</dd></dl> 289</dd></dl>
239 290
240<dl class="method"> 291<dl class="method">