123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <!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.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="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.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.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.DynamicPool">
- <em class="property">
- class </em><tt class="descclassname">celery.pool.</tt><tt class="descname">DynamicPool</tt><big>(</big><em>processes=None</em>, <em>initializer=None</em>, <em>initargs=()</em><big>)</big><a class="headerlink" href="#celery.pool.DynamicPool" title="Permalink to this definition">¶</a></dt>
- <dd><p>Version of <tt class="xref docutils literal"><span class="pre">multiprocessing.Pool</span></tt> that can dynamically grow
- in size.</p>
- <dl class="method">
- <dt id="celery.pool.DynamicPool.add_worker">
- <tt class="descname">add_worker</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.DynamicPool.add_worker" title="Permalink to this definition">¶</a></dt>
- <dd>Add another worker to the pool.</dd></dl>
- <dl class="method">
- <dt id="celery.pool.DynamicPool.grow">
- <tt class="descname">grow</tt><big>(</big><em>size=1</em><big>)</big><a class="headerlink" href="#celery.pool.DynamicPool.grow" title="Permalink to this definition">¶</a></dt>
- <dd><p>Add workers to the pool.</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">Parameter:</th><td class="field-body"><em>size</em> – Number of workers to add (default: 1)</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="celery.pool.DynamicPool.replace_dead_workers">
- <tt class="descname">replace_dead_workers</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.pool.DynamicPool.replace_dead_workers" title="Permalink to this definition">¶</a></dt>
- <dd><p>Replace dead workers in the pool by spawning new ones.</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">number of dead processes replaced, or <tt class="xref docutils literal"><span class="pre">None</span></tt> if all
- processes are alive and running.</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- </dd></dl>
- <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>Process Pool for processing tasks in parallel.</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.</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_ack=<function <lambda> at 0x21a7c70></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 since
- otherwise the thread which handles the result will get blocked.</p>
- </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>on_ack</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 has
- been collected.</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>
- </dd></dl>
- <dl class="function">
- <dt id="celery.pool.pid_is_dead">
- <tt class="descclassname">celery.pool.</tt><tt class="descname">pid_is_dead</tt><big>(</big><em>pid</em><big>)</big><a class="headerlink" href="#celery.pool.pid_is_dead" title="Permalink to this definition">¶</a></dt>
- <dd><p>Check if a process is not running by PID.</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">Rtype bool:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="function">
- <dt id="celery.pool.process_is_dead">
- <tt class="descclassname">celery.pool.</tt><tt class="descname">process_is_dead</tt><big>(</big><em>process</em><big>)</big><a class="headerlink" href="#celery.pool.process_is_dead" title="Permalink to this definition">¶</a></dt>
- <dd><p>Check if process is not running anymore.</p>
- <p>First it finds out if the process is running by sending
- signal 0. Then if the process is a child process, and is running
- it finds out if it’s a zombie process and reaps it.
- If the process is running and is not a zombie it tries to send
- a ping through the process pipe.</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">Parameter:</th><td class="field-body"><em>process</em> – A <tt class="xref docutils literal"><span class="pre">multiprocessing.Process</span></tt> instance.</td>
- </tr>
- <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 process is not running, <tt class="xref docutils literal"><span class="pre">False</span></tt> otherwise.</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="function">
- <dt id="celery.pool.reap_process">
- <tt class="descclassname">celery.pool.</tt><tt class="descname">reap_process</tt><big>(</big><em>pid</em><big>)</big><a class="headerlink" href="#celery.pool.reap_process" title="Permalink to this definition">¶</a></dt>
- <dd><p>Reap process if the process is a zombie.</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 process was reaped or is not running,
- <tt class="xref docutils literal"><span class="pre">False</span></tt> otherwise.</td>
- </tr>
- </tbody>
- </table>
- </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.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>
|