123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>Task Information and Utilities - celery.task — Celery v0.7.0 (unstable) documentation</title>
- <link rel="stylesheet" href="../static/nature.css" type="text/css" />
- <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '../',
- VERSION: '0.7.0 (unstable)',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="../static/jquery.js"></script>
- <script type="text/javascript" src="../static/doctools.js"></script>
- <link rel="top" title="Celery v0.7.0 (unstable) documentation" href="../index.html" />
- <link rel="up" title="Module API Reference" href="index.html" />
- <link rel="next" title="Task Registry - celery.registry" href="celery.registry.html" />
- <link rel="prev" title="Task Result - celery.result" href="celery.result.html" />
- </head>
- <body>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="../genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="../modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li class="right" >
- <a href="celery.registry.html" title="Task Registry - celery.registry"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="celery.result.html" title="Task Result - celery.result"
- accesskey="P">previous</a> |</li>
- <li><a href="../index.html">Celery v0.7.0 (unstable) documentation</a> »</li>
- <li><a href="index.html" accesskey="U">Module API Reference</a> »</li>
- </ul>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
- <div class="section" id="module-celery.task">
- <h1>Task Information and Utilities - celery.task<a class="headerlink" href="#module-celery.task" title="Permalink to this headline">¶</a></h1>
- <p>Working with tasks and task sets.</p>
- <dl class="function">
- <dt id="celery.task.discard_all">
- <tt class="descclassname">celery.task.</tt><tt class="descname">discard_all</tt><big>(</big><em>connect_timeout=4</em><big>)</big><a class="headerlink" href="#celery.task.discard_all" title="Permalink to this definition">¶</a></dt>
- <dd><p>Discard all waiting tasks.</p>
- <p>This will ignore all tasks waiting for execution, and they will
- be deleted from the messaging server.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the number of tasks discarded.</td>
- </tr>
- <tr class="field"><th class="field-name">Return type:</th><td class="field-body">int</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="function">
- <dt id="celery.task.dmap">
- <tt class="descclassname">celery.task.</tt><tt class="descname">dmap</tt><big>(</big><em>func</em>, <em>args</em>, <em>timeout=None</em><big>)</big><a class="headerlink" href="#celery.task.dmap" title="Permalink to this definition">¶</a></dt>
- <dd><p>Distribute processing of the arguments and collect the results.</p>
- <p>Example</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">dmap</span>
- <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">operator</span>
- <span class="gp">>>> </span><span class="n">dmap</span><span class="p">(</span><span class="n">operator</span><span class="o">.</span><span class="n">add</span><span class="p">,</span> <span class="p">[[</span><span class="mf">2</span><span class="p">,</span> <span class="mf">2</span><span class="p">],</span> <span class="p">[</span><span class="mf">4</span><span class="p">,</span> <span class="mf">4</span><span class="p">],</span> <span class="p">[</span><span class="mf">8</span><span class="p">,</span> <span class="mf">8</span><span class="p">]])</span>
- <span class="go">[4, 8, 16]</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="celery.task.dmap_async">
- <tt class="descclassname">celery.task.</tt><tt class="descname">dmap_async</tt><big>(</big><em>func</em>, <em>args</em>, <em>timeout=None</em><big>)</big><a class="headerlink" href="#celery.task.dmap_async" title="Permalink to this definition">¶</a></dt>
- <dd><p>Distribute processing of the arguments and collect the results
- asynchronously.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><a title="celery.result.AsyncResult" class="reference external" href="celery.result.html#celery.result.AsyncResult"><tt class="xref docutils literal"><span class="pre">celery.result.AsyncResult</span></tt></a> object.</td>
- </tr>
- </tbody>
- </table>
- <p>Example</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">dmap_async</span>
- <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">operator</span>
- <span class="gp">>>> </span><span class="n">presult</span> <span class="o">=</span> <span class="n">dmap_async</span><span class="p">(</span><span class="n">operator</span><span class="o">.</span><span class="n">add</span><span class="p">,</span> <span class="p">[[</span><span class="mf">2</span><span class="p">,</span> <span class="mf">2</span><span class="p">],</span> <span class="p">[</span><span class="mf">4</span><span class="p">,</span> <span class="mf">4</span><span class="p">],</span> <span class="p">[</span><span class="mf">8</span><span class="p">,</span> <span class="mf">8</span><span class="p">]])</span>
- <span class="gp">>>> </span><span class="n">presult</span>
- <span class="go"><AsyncResult: 373550e8-b9a0-4666-bc61-ace01fa4f91d></span>
- <span class="gp">>>> </span><span class="n">presult</span><span class="o">.</span><span class="n">status</span>
- <span class="go">'DONE'</span>
- <span class="gp">>>> </span><span class="n">presult</span><span class="o">.</span><span class="n">result</span>
- <span class="go">[4, 8, 16]</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="celery.task.execute_remote">
- <tt class="descclassname">celery.task.</tt><tt class="descname">execute_remote</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.task.execute_remote" title="Permalink to this definition">¶</a></dt>
- <dd><p>Execute arbitrary function/object remotely.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
- <li><em>func</em> – A callable function or object.</li>
- <li><em>*args</em> – Positional arguments to apply to the function.</li>
- <li><em>**kwargs</em> – Keyword arguments to apply to the function.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <p>The object must be picklable, so you can’t use lambdas or functions
- defined in the REPL (the objects must have an associated module).</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Returns:</th><td class="field-body">class:<cite>celery.result.AsyncResult</cite>.</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="function">
- <dt id="celery.task.is_done">
- <tt class="descclassname">celery.task.</tt><tt class="descname">is_done</tt><big>(</big><em>task_id</em><big>)</big><a class="headerlink" href="#celery.task.is_done" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns <tt class="xref docutils literal"><span class="pre">True</span></tt> if task with <tt class="docutils literal"><span class="pre">task_id</span></tt> has been executed.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="function">
- <dt id="celery.task.ping">
- <tt class="descclassname">celery.task.</tt><tt class="descname">ping</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.task.ping" title="Permalink to this definition">¶</a></dt>
- <dd><p>Test if the server is alive.</p>
- <p>Example:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">ping</span>
- <span class="gp">>>> </span><span class="n">ping</span><span class="p">()</span>
- <span class="go">'pong'</span>
- </pre></div>
- </div>
- </dd></dl>
- </div>
- </div>
- </div>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- <h4>Previous topic</h4>
- <p class="topless"><a href="celery.result.html"
- title="previous chapter">Task Result - celery.result</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="celery.registry.html"
- title="next chapter">Task Registry - celery.registry</a></p>
- <h3>This Page</h3>
- <ul class="this-page-menu">
- <li><a href="../sources/reference/celery.task.txt"
- rel="nofollow">Show Source</a></li>
- </ul>
- <div id="searchbox" style="display: none">
- <h3>Quick search</h3>
- <form class="search" action="../search.html" method="get">
- <input type="text" name="q" size="18" />
- <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- <p class="searchtip" style="font-size: 90%">
- Enter search terms or a module, class or function name.
- </p>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="../genindex.html" title="General Index"
- >index</a></li>
- <li class="right" >
- <a href="../modindex.html" title="Global Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="celery.registry.html" title="Task Registry - celery.registry"
- >next</a> |</li>
- <li class="right" >
- <a href="celery.result.html" title="Task Result - celery.result"
- >previous</a> |</li>
- <li><a href="../index.html">Celery v0.7.0 (unstable) documentation</a> »</li>
- <li><a href="index.html" >Module API Reference</a> »</li>
- </ul>
- </div>
- <div class="footer">
- © Copyright 2009, Ask Solem.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
- </div>
- </body>
- </html>
|