aboutsummaryrefslogtreecommitdiffstats
path: root/client/jobs.html
diff options
context:
space:
mode:
Diffstat (limited to 'client/jobs.html')
-rwxr-xr-xclient/jobs.html108
1 files changed, 107 insertions, 1 deletions
diff --git a/client/jobs.html b/client/jobs.html
index ee1e871..1da5fca 100755
--- a/client/jobs.html
+++ b/client/jobs.html
@@ -64,7 +64,7 @@
64 64
65 65
66 <div class="version"> 66 <div class="version">
67 0.3 67 0.3.2
68 </div> 68 </div>
69 69
70 70
@@ -157,6 +157,10 @@
157<dt id="eventmq.client.jobs.Job"> 157<dt id="eventmq.client.jobs.Job">
158<em class="property">class </em><code class="descclassname">eventmq.client.jobs.</code><code class="descname">Job</code><span class="sig-paren">(</span><em>broker_addr=None</em>, <em>queue=None</em>, <em>async=True</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.client.jobs.Job" title="Permalink to this definition">¶</a></dt> 158<em class="property">class </em><code class="descclassname">eventmq.client.jobs.</code><code class="descname">Job</code><span class="sig-paren">(</span><em>broker_addr=None</em>, <em>queue=None</em>, <em>async=True</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.client.jobs.Job" title="Permalink to this definition">¶</a></dt>
159<dd><p>Defines a deferred EventMQ job.</p> 159<dd><p>Defines a deferred EventMQ job.</p>
160<div class="admonition note">
161<p class="first admonition-title">Note</p>
162<p class="last">All passed class &amp; function kwargs/args MUST be json serializable.</p>
163</div>
160<p>Usage:</p> 164<p>Usage:</p>
161<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">eventmq</span> <span class="kn">import</span> <span class="n">job</span> 165<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">eventmq</span> <span class="kn">import</span> <span class="n">job</span>
162 166
@@ -217,6 +221,108 @@ can set this to False. This is useful for unit tests.</li>
217<a class="reference internal" href="#eventmq.client.jobs.Job" title="eventmq.client.jobs.Job"><code class="xref py py-class docutils literal"><span class="pre">Job</span></code></a> for more information.</p> 221<a class="reference internal" href="#eventmq.client.jobs.Job" title="eventmq.client.jobs.Job"><code class="xref py py-class docutils literal"><span class="pre">Job</span></code></a> for more information.</p>
218</dd></dl> 222</dd></dl>
219 223
224<dl class="function">
225<dt id="eventmq.client.jobs.schedule">
226<code class="descclassname">eventmq.client.jobs.</code><code class="descname">schedule</code><span class="sig-paren">(</span><em>func</em>, <em>broker_addr=None</em>, <em>interval_secs=None</em>, <em>args=()</em>, <em>kwargs=None</em>, <em>class_args=()</em>, <em>class_kwargs=None</em>, <em>headers=('guarantee'</em>, <em>)</em>, <em>queue='default'</em>, <em>cron=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.client.jobs.schedule" title="Permalink to this definition">¶</a></dt>
227<dd><p>Execute a task on a defined interval.</p>
228<div class="admonition note">
229<p class="first admonition-title">Note</p>
230<p class="last">All passed class &amp; function kwargs/args MUST be json serializable.</p>
231</div>
232<table class="docutils field-list" frame="void" rules="none">
233<col class="field-name" />
234<col class="field-body" />
235<tbody valign="top">
236<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
237<li><strong>func</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#callable" title="(in Python v2.7)"><em>callable</em></a>) &#8211; the callable (or string path to calable) to be
238scheduled on a worker</li>
239<li><strong>broker_addr</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Address of the broker to send the job to. If no
240address is given then the value of the environment variable
241<code class="docutils literal"><span class="pre">EMQ_BROKER_ADDR</span></code> will be used.</li>
242<li><strong>interval_secs</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; Run job every interval_secs or None if using cron</li>
243<li><strong>args</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of <a href="#id1"><span class="problematic" id="id2">*</span></a>args to pass to the callable</li>
244<li><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/2/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; dict of <a href="#id3"><span class="problematic" id="id4">**</span></a>kwargs to pass to the callable</li>
245<li><strong>class_args</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of <a href="#id5"><span class="problematic" id="id6">*</span></a>args to pass to the class (if applicable)</li>
246<li><strong>class_kwargs</strong> (<a class="reference external" href="https://docs.python.org/2/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; dict of <a href="#id7"><span class="problematic" id="id8">**</span></a>kwargs to pass to the class (if
247applicable)</li>
248<li><strong>headers</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of strings denoting enabled headers. Default:
249guarantee is enabled to ensure the scheduler schedules the job.</li>
250<li><strong>queue</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; name of the queue to use when executing the job. The
251default value is the default queue.</li>
252<li><strong>cron</strong> (<a class="reference external" href="https://docs.python.org/2/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; cron formatted string used for job schedule if
253interval_secs is None, i.e. &#8216;* * * * <a href="#id9"><span class="problematic" id="id10">*</span></a>&#8216; (every minute)</li>
254</ul>
255</td>
256</tr>
257<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><code class="xref py py-exc docutils literal"><span class="pre">TypeError</span></code> &#8211; When one or more parameters are not JSON serializable.</p>
258</td>
259</tr>
260<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils">
261<dt>ID of the schedule message that was sent. None if there was an</dt>
262<dd><p class="first last">error</p>
263</dd>
264</dl>
265</p>
266</td>
267</tr>
268<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)">str</a></p>
269</td>
270</tr>
271</tbody>
272</table>
273</dd></dl>
274
275<dl class="function">
276<dt id="eventmq.client.jobs.unschedule">
277<code class="descclassname">eventmq.client.jobs.</code><code class="descname">unschedule</code><span class="sig-paren">(</span><em>func</em>, <em>broker_addr=None</em>, <em>interval_secs=None</em>, <em>args=()</em>, <em>kwargs=None</em>, <em>class_args=()</em>, <em>class_kwargs=None</em>, <em>headers=('guarantee'</em>, <em>)</em>, <em>queue='default'</em>, <em>cron=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.client.jobs.unschedule" title="Permalink to this definition">¶</a></dt>
278<dd><p>Stop periodically executing a task</p>
279<div class="admonition note">
280<p class="first admonition-title">Note</p>
281<p class="last">All passed class &amp; function kwargs/args MUST be json serializable.</p>
282</div>
283<table class="docutils field-list" frame="void" rules="none">
284<col class="field-name" />
285<col class="field-body" />
286<tbody valign="top">
287<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
288<li><strong>func</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#callable" title="(in Python v2.7)"><em>callable</em></a>) &#8211; the callable (or string path to calable) to be
289scheduled on a worker</li>
290<li><strong>broker_addr</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Address of the broker to send the job to. If no
291address is given then the value of the environment variable
292<code class="docutils literal"><span class="pre">EMQ_BROKER_ADDR</span></code> will be used.</li>
293<li><strong>interval_secs</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; Run job every interval_secs or None if using cron</li>
294<li><strong>args</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of <a href="#id11"><span class="problematic" id="id12">*</span></a>args to pass to the callable</li>
295<li><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/2/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; dict of <a href="#id13"><span class="problematic" id="id14">**</span></a>kwargs to pass to the callable</li>
296<li><strong>class_args</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of <a href="#id15"><span class="problematic" id="id16">*</span></a>args to pass to the class (if applicable)</li>
297<li><strong>class_kwargs</strong> (<a class="reference external" href="https://docs.python.org/2/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; dict of <a href="#id17"><span class="problematic" id="id18">**</span></a>kwargs to pass to the class (if
298applicable)</li>
299<li><strong>headers</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of strings denoting enabled headers. Default:
300guarantee is enabled to ensure the scheduler schedules the job.</li>
301<li><strong>queue</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; name of the queue to use when executing the job. The
302default value is the default queue.</li>
303<li><strong>cron</strong> (<a class="reference external" href="https://docs.python.org/2/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; cron formatted string used for job schedule if
304interval_secs is None, i.e. &#8216;* * * * <a href="#id19"><span class="problematic" id="id20">*</span></a>&#8216; (every minute)</li>
305</ul>
306</td>
307</tr>
308<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><code class="xref py py-exc docutils literal"><span class="pre">TypeError</span></code> &#8211; When one or more parameters are not JSON serializable.</p>
309</td>
310</tr>
311<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils">
312<dt>ID of the schedule message that was sent. None if there was an</dt>
313<dd><p class="first last">error</p>
314</dd>
315</dl>
316</p>
317</td>
318</tr>
319<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)">str</a></p>
320</td>
321</tr>
322</tbody>
323</table>
324</dd></dl>
325
220</div> 326</div>
221 327
222 328