celery.supervisor.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Process Supervisor - celery.supervisor &mdash; Celery v0.7.0 (unstable) documentation</title>
  7. <link rel="stylesheet" href="../static/nature.css" type="text/css" />
  8. <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../',
  12. VERSION: '0.7.0 (unstable)',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../static/jquery.js"></script>
  19. <script type="text/javascript" src="../static/doctools.js"></script>
  20. <link rel="top" title="Celery v0.7.0 (unstable) documentation" href="../index.html" />
  21. <link rel="up" title="Module API Reference" href="index.html" />
  22. <link rel="next" title="Backends - celery.backends" href="celery.backends.html" />
  23. <link rel="prev" title="Task Pool - celery.pool" href="celery.pool.html" />
  24. </head>
  25. <body>
  26. <div class="related">
  27. <h3>Navigation</h3>
  28. <ul>
  29. <li class="right" style="margin-right: 10px">
  30. <a href="../genindex.html" title="General Index"
  31. accesskey="I">index</a></li>
  32. <li class="right" >
  33. <a href="../modindex.html" title="Global Module Index"
  34. accesskey="M">modules</a> |</li>
  35. <li class="right" >
  36. <a href="celery.backends.html" title="Backends - celery.backends"
  37. accesskey="N">next</a> |</li>
  38. <li class="right" >
  39. <a href="celery.pool.html" title="Task Pool - celery.pool"
  40. accesskey="P">previous</a> |</li>
  41. <li><a href="../index.html">Celery v0.7.0 (unstable) documentation</a> &raquo;</li>
  42. <li><a href="index.html" accesskey="U">Module API Reference</a> &raquo;</li>
  43. </ul>
  44. </div>
  45. <div class="document">
  46. <div class="documentwrapper">
  47. <div class="bodywrapper">
  48. <div class="body">
  49. <div class="section" id="module-celery.supervisor">
  50. <h1>Process Supervisor - celery.supervisor<a class="headerlink" href="#module-celery.supervisor" title="Permalink to this headline">¶</a></h1>
  51. <dl class="exception">
  52. <dt id="celery.supervisor.MaxRestartsExceededError">
  53. <em class="property">
  54. exception </em><tt class="descclassname">celery.supervisor.</tt><tt class="descname">MaxRestartsExceededError</tt><a class="headerlink" href="#celery.supervisor.MaxRestartsExceededError" title="Permalink to this definition">¶</a></dt>
  55. <dd>Restarts exceeded the maximum restart frequency.</dd></dl>
  56. <dl class="class">
  57. <dt id="celery.supervisor.OFASupervisor">
  58. <em class="property">
  59. class </em><tt class="descclassname">celery.supervisor.</tt><tt class="descname">OFASupervisor</tt><big>(</big><em>target</em>, <em>args=None</em>, <em>kwargs=None</em>, <em>max_restart_freq=3</em>, <em>join_timeout=2</em>, <em>max_restart_freq_time=10</em>, <em>check_interval=2</em><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor" title="Permalink to this definition">¶</a></dt>
  60. <dd><p>Process supervisor using the <a class="reference external" href="http://erlang.org/doc/design_principles/sup_princ.html#5.3.2">one_for_all</a> strategy.</p>
  61. <p>However, instead of registering a list of processes, you have one
  62. process which runs a pool. Makes for an easy implementation.</p>
  63. <table class="docutils field-list" frame="void" rules="none">
  64. <col class="field-name" />
  65. <col class="field-body" />
  66. <tbody valign="top">
  67. <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  68. <li><em>target</em> &#8211; see <a title="celery.supervisor.OFASupervisor.target" class="reference internal" href="#celery.supervisor.OFASupervisor.target"><tt class="xref docutils literal"><span class="pre">target</span></tt></a>.</li>
  69. <li><em>args</em> &#8211; see <a title="celery.supervisor.OFASupervisor.args" class="reference internal" href="#celery.supervisor.OFASupervisor.args"><tt class="xref docutils literal"><span class="pre">args</span></tt></a>.</li>
  70. <li><em>kwargs</em> &#8211; see <a title="celery.supervisor.OFASupervisor.kwargs" class="reference internal" href="#celery.supervisor.OFASupervisor.kwargs"><tt class="xref docutils literal"><span class="pre">kwargs</span></tt></a>.</li>
  71. <li><em>max_restart_freq</em> &#8211; see <a title="celery.supervisor.OFASupervisor.max_restart_freq" class="reference internal" href="#celery.supervisor.OFASupervisor.max_restart_freq"><tt class="xref docutils literal"><span class="pre">max_restart_freq</span></tt></a>.</li>
  72. <li><em>max_restart_freq_time</em> &#8211; see <a title="celery.supervisor.OFASupervisor.max_restart_freq_time" class="reference internal" href="#celery.supervisor.OFASupervisor.max_restart_freq_time"><tt class="xref docutils literal"><span class="pre">max_restart_freq_time</span></tt></a>.</li>
  73. <li><em>check_interval</em> &#8211; see <a title="celery.supervisor.OFASupervisor.max_restart_freq_time" class="reference internal" href="#celery.supervisor.OFASupervisor.max_restart_freq_time"><tt class="xref docutils literal"><span class="pre">max_restart_freq_time</span></tt></a>.</li>
  74. </ul>
  75. </td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. <dl class="attribute">
  80. <dt id="celery.supervisor.OFASupervisor.target">
  81. <tt class="descname">target</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.target" title="Permalink to this definition">¶</a></dt>
  82. <dd>The target callable to be launched in a new process.</dd></dl>
  83. <dl class="attribute">
  84. <dt id="celery.supervisor.OFASupervisor.args">
  85. <tt class="descname">args</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.args" title="Permalink to this definition">¶</a></dt>
  86. <dd>The positional arguments to apply to <a title="celery.supervisor.OFASupervisor.target" class="reference internal" href="#celery.supervisor.OFASupervisor.target"><tt class="xref docutils literal"><span class="pre">target</span></tt></a>.</dd></dl>
  87. <dl class="attribute">
  88. <dt id="celery.supervisor.OFASupervisor.kwargs">
  89. <tt class="descname">kwargs</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.kwargs" title="Permalink to this definition">¶</a></dt>
  90. <dd>The keyword arguments to apply to <a title="celery.supervisor.OFASupervisor.target" class="reference internal" href="#celery.supervisor.OFASupervisor.target"><tt class="xref docutils literal"><span class="pre">target</span></tt></a>.</dd></dl>
  91. <dl class="attribute">
  92. <dt id="celery.supervisor.OFASupervisor.max_restart_freq">
  93. <tt class="descname">max_restart_freq</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.max_restart_freq" title="Permalink to this definition">¶</a></dt>
  94. <dd><p>Limit the number of restarts which can occur in a given time interval.</p>
  95. <p>The max restart frequency is the number of restarts that can occur
  96. within the interval <a title="celery.supervisor.OFASupervisor.max_restart_freq_time" class="reference internal" href="#celery.supervisor.OFASupervisor.max_restart_freq_time"><tt class="xref docutils literal"><span class="pre">max_restart_freq_time</span></tt></a>.</p>
  97. <p>The restart mechanism prevents situations where the process repeatedly
  98. dies for the same reason. If this happens both the process and the
  99. supervisor is terminated.</p>
  100. </dd></dl>
  101. <dl class="attribute">
  102. <dt id="celery.supervisor.OFASupervisor.max_restart_freq_time">
  103. <tt class="descname">max_restart_freq_time</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.max_restart_freq_time" title="Permalink to this definition">¶</a></dt>
  104. <dd>See <a title="celery.supervisor.OFASupervisor.max_restart_freq" class="reference internal" href="#celery.supervisor.OFASupervisor.max_restart_freq"><tt class="xref docutils literal"><span class="pre">max_restart_freq</span></tt></a>.</dd></dl>
  105. <dl class="attribute">
  106. <dt id="celery.supervisor.OFASupervisor.check_interval">
  107. <tt class="descname">check_interval</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.check_interval" title="Permalink to this definition">¶</a></dt>
  108. <dd>The time in seconds, between process pings.</dd></dl>
  109. <dl class="class">
  110. <dt id="celery.supervisor.OFASupervisor.Process">
  111. <em class="property">
  112. class </em><tt class="descname">Process</tt><big>(</big><em>group=None</em>, <em>target=None</em>, <em>name=None</em>, <em>args=()</em>, <em>kwargs={}</em><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process" title="Permalink to this definition">¶</a></dt>
  113. <dd><p>Process objects represent activity that is run in a separate process</p>
  114. <p>The class is analagous to <cite>threading.Thread</cite></p>
  115. <dl class="attribute">
  116. <dt id="celery.supervisor.OFASupervisor.Process.daemon">
  117. <tt class="descname">daemon</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.daemon" title="Permalink to this definition">¶</a></dt>
  118. <dd>Return whether process is a daemon</dd></dl>
  119. <dl class="attribute">
  120. <dt id="celery.supervisor.OFASupervisor.Process.exitcode">
  121. <tt class="descname">exitcode</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.exitcode" title="Permalink to this definition">¶</a></dt>
  122. <dd>Return exit code of process or <cite>None</cite> if it has yet to stop</dd></dl>
  123. <dl class="attribute">
  124. <dt id="celery.supervisor.OFASupervisor.Process.ident">
  125. <tt class="descname">ident</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.ident" title="Permalink to this definition">¶</a></dt>
  126. <dd>Return indentifier (PID) of process or <cite>None</cite> if it has yet to start</dd></dl>
  127. <dl class="method">
  128. <dt id="celery.supervisor.OFASupervisor.Process.is_alive">
  129. <tt class="descname">is_alive</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.is_alive" title="Permalink to this definition">¶</a></dt>
  130. <dd>Return whether process is alive</dd></dl>
  131. <dl class="method">
  132. <dt id="celery.supervisor.OFASupervisor.Process.join">
  133. <tt class="descname">join</tt><big>(</big><em>timeout=None</em><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.join" title="Permalink to this definition">¶</a></dt>
  134. <dd>Wait until child process terminates</dd></dl>
  135. <dl class="attribute">
  136. <dt id="celery.supervisor.OFASupervisor.Process.pid">
  137. <tt class="descname">pid</tt><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.pid" title="Permalink to this definition">¶</a></dt>
  138. <dd>Return indentifier (PID) of process or <cite>None</cite> if it has yet to start</dd></dl>
  139. <dl class="method">
  140. <dt id="celery.supervisor.OFASupervisor.Process.run">
  141. <tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.run" title="Permalink to this definition">¶</a></dt>
  142. <dd>Method to be run in sub-process; can be overridden in sub-class</dd></dl>
  143. <dl class="method">
  144. <dt id="celery.supervisor.OFASupervisor.Process.start">
  145. <tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.start" title="Permalink to this definition">¶</a></dt>
  146. <dd>Start child process</dd></dl>
  147. <dl class="method">
  148. <dt id="celery.supervisor.OFASupervisor.Process.terminate">
  149. <tt class="descname">terminate</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.Process.terminate" title="Permalink to this definition">¶</a></dt>
  150. <dd>Terminate process; sends SIGTERM signal or uses TerminateProcess()</dd></dl>
  151. </dd></dl>
  152. <dl class="method">
  153. <dt id="celery.supervisor.OFASupervisor.start">
  154. <tt class="descclassname">OFASupervisor.</tt><tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.supervisor.OFASupervisor.start" title="Permalink to this definition">¶</a></dt>
  155. <dd>Launches the <a title="celery.supervisor.OFASupervisor.target" class="reference internal" href="#celery.supervisor.OFASupervisor.target"><tt class="xref docutils literal"><span class="pre">target</span></tt></a> in a seperate process and starts
  156. supervising it.</dd></dl>
  157. </dd></dl>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="sphinxsidebar">
  163. <div class="sphinxsidebarwrapper">
  164. <h4>Previous topic</h4>
  165. <p class="topless"><a href="celery.pool.html"
  166. title="previous chapter">Task Pool - celery.pool</a></p>
  167. <h4>Next topic</h4>
  168. <p class="topless"><a href="celery.backends.html"
  169. title="next chapter">Backends - celery.backends</a></p>
  170. <h3>This Page</h3>
  171. <ul class="this-page-menu">
  172. <li><a href="../sources/reference/celery.supervisor.txt"
  173. rel="nofollow">Show Source</a></li>
  174. </ul>
  175. <div id="searchbox" style="display: none">
  176. <h3>Quick search</h3>
  177. <form class="search" action="../search.html" method="get">
  178. <input type="text" name="q" size="18" />
  179. <input type="submit" value="Go" />
  180. <input type="hidden" name="check_keywords" value="yes" />
  181. <input type="hidden" name="area" value="default" />
  182. </form>
  183. <p class="searchtip" style="font-size: 90%">
  184. Enter search terms or a module, class or function name.
  185. </p>
  186. </div>
  187. <script type="text/javascript">$('#searchbox').show(0);</script>
  188. </div>
  189. </div>
  190. <div class="clearer"></div>
  191. </div>
  192. <div class="related">
  193. <h3>Navigation</h3>
  194. <ul>
  195. <li class="right" style="margin-right: 10px">
  196. <a href="../genindex.html" title="General Index"
  197. >index</a></li>
  198. <li class="right" >
  199. <a href="../modindex.html" title="Global Module Index"
  200. >modules</a> |</li>
  201. <li class="right" >
  202. <a href="celery.backends.html" title="Backends - celery.backends"
  203. >next</a> |</li>
  204. <li class="right" >
  205. <a href="celery.pool.html" title="Task Pool - celery.pool"
  206. >previous</a> |</li>
  207. <li><a href="../index.html">Celery v0.7.0 (unstable) documentation</a> &raquo;</li>
  208. <li><a href="index.html" >Module API Reference</a> &raquo;</li>
  209. </ul>
  210. </div>
  211. <div class="footer">
  212. &copy; Copyright 2009, Ask Solem.
  213. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
  214. </div>
  215. </body>
  216. </html>