| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 | <!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 Pool - celery.pool — Celery v0.4.0 (stable) 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.4.0 (stable)',        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.4.0 (stable) documentation" href="../index.html" />    <link rel="up" title="Module API Reference" href="index.html" />    <link rel="next" title="Process Supervisor - celery.supervisor" href="celery.supervisor.html" />    <link rel="prev" title="Worker Controller Threads - celery.worker.controllers" href="celery.worker.controllers.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.supervisor.html" title="Process Supervisor - celery.supervisor"             accesskey="N">next</a> |</li>        <li class="right" >          <a href="celery.worker.controllers.html" title="Worker Controller Threads - celery.worker.controllers"             accesskey="P">previous</a> |</li>        <li><a href="../index.html">Celery v0.4.0 (stable) 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.pool"><h1>Task Pool - celery.pool<a class="headerlink" href="#module-celery.pool" title="Permalink to this headline">¶</a></h1><p>Process Pools.</p><dl class="class"><dt id="celery.pool.TaskPool"><em class="property">class </em><tt class="descclassname">celery.pool.</tt><tt class="descname">TaskPool</tt><big>(</big><em>limit</em>, <em>logger=None</em><big>)</big><a class="headerlink" href="#celery.pool.TaskPool" title="Permalink to this definition">¶</a></dt><dd><p>Pool of running child processes, which starts waiting for theprocesses to finish when the queue limit has been reached.</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>limit</em> – see <a title="celery.pool.TaskPool.limit" class="reference internal" href="#celery.pool.TaskPool.limit"><tt class="xref docutils literal"><span class="pre">limit</span></tt></a> attribute.</li><li><em>logger</em> – see <a title="celery.pool.TaskPool.logger" class="reference internal" href="#celery.pool.TaskPool.logger"><tt class="xref docutils literal"><span class="pre">logger</span></tt></a> attribute.</li></ul></td></tr></tbody></table><dl class="attribute"><dt id="celery.pool.TaskPool.limit"><tt class="descname">limit</tt><a class="headerlink" href="#celery.pool.TaskPool.limit" title="Permalink to this definition">¶</a></dt><dd>The number of processes that can run simultaneously untilwe start collecting results.</dd></dl><dl class="attribute"><dt id="celery.pool.TaskPool.logger"><tt class="descname">logger</tt><a class="headerlink" href="#celery.pool.TaskPool.logger" title="Permalink to this definition">¶</a></dt><dd>The logger used for debugging.</dd></dl><dl class="method"><dt id="celery.pool.TaskPool.apply_async"><tt class="descname">apply_async</tt><big>(</big><em>target</em>, <em>args=None</em>, <em>kwargs=None</em>, <em>callbacks=None</em>, <em>errbacks=None</em>, <em>on_acknowledge=None</em>, <em>meta=None</em><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.apply_async" title="Permalink to this definition">¶</a></dt><dd><p>Equivalent of the :func:<tt class="docutils literal"><span class="pre">apply</span></tt> built-in function.</p><p>All <tt class="docutils literal"><span class="pre">callbacks</span></tt> and <tt class="docutils literal"><span class="pre">errbacks</span></tt> should complete immediately sinceotherwise the thread which handles the result will get blocked.</p></dd></dl><dl class="method"><dt id="celery.pool.TaskPool.full"><tt class="descname">full</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.full" title="Permalink to this definition">¶</a></dt><dd><p>Is the pool full?</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"><tt class="xref docutils literal"><span class="pre">True</span></tt> if the maximum number of concurrent processeshas been reached.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.pool.TaskPool.get_worker_pids"><tt class="descname">get_worker_pids</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.get_worker_pids" title="Permalink to this definition">¶</a></dt><dd>Returns the process id’s of all the pool workers.</dd></dl><dl class="method"><dt id="celery.pool.TaskPool.on_ready"><tt class="descname">on_ready</tt><big>(</big><em>callbacks</em>, <em>errbacks</em>, <em>meta</em>, <em>ret_value</em><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.on_ready" title="Permalink to this definition">¶</a></dt><dd>What to do when a worker task is ready and its return value hasbeen collected.</dd></dl><dl class="method"><dt id="celery.pool.TaskPool.on_return"><tt class="descname">on_return</tt><big>(</big><em>tid</em>, <em>callbacks</em>, <em>errbacks</em>, <em>meta</em>, <em>ret_value</em><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.on_return" title="Permalink to this definition">¶</a></dt><dd>What to do when the process returns.</dd></dl><dl class="method"><dt id="celery.pool.TaskPool.reap"><tt class="descname">reap</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.reap" title="Permalink to this definition">¶</a></dt><dd>Reap finished tasks.</dd></dl><dl class="method"><dt id="celery.pool.TaskPool.start"><tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.start" title="Permalink to this definition">¶</a></dt><dd><p>Run the task pool.</p><p>Will pre-fork all workers so they’re ready to accept tasks.</p></dd></dl><dl class="method"><dt id="celery.pool.TaskPool.stop"><tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.stop" title="Permalink to this definition">¶</a></dt><dd>Terminate the pool.</dd></dl><dl class="method"><dt id="celery.pool.TaskPool.wait_for_result"><tt class="descname">wait_for_result</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.TaskPool.wait_for_result" title="Permalink to this definition">¶</a></dt><dd><p>Waits for the first process in the pool to finish.</p><p>This operation is blocking.</p></dd></dl></dd></dl></div>          </div>        </div>      </div>      <div class="sphinxsidebar">        <div class="sphinxsidebarwrapper">            <h4>Previous topic</h4>            <p class="topless"><a href="celery.worker.controllers.html"                                  title="previous chapter">Worker Controller Threads - celery.worker.controllers</a></p>            <h4>Next topic</h4>            <p class="topless"><a href="celery.supervisor.html"                                  title="next chapter">Process Supervisor - celery.supervisor</a></p>            <h3>This Page</h3>            <ul class="this-page-menu">              <li><a href="../sources/reference/celery.pool.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.supervisor.html" title="Process Supervisor - celery.supervisor"             >next</a> |</li>        <li class="right" >          <a href="celery.worker.controllers.html" title="Worker Controller Threads - celery.worker.controllers"             >previous</a> |</li>        <li><a href="../index.html">Celery v0.4.0 (stable) 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.1.    </div>  </body></html>
 |