celery.worker.html 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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>Multiprocessing Worker - celery.worker &mdash; Celery v0.1.14 documentation</title>
  7. <link rel="stylesheet" href="../static/default.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.1.14',
  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.1.14 documentation" href="../index.html" />
  21. <link rel="next" title="Backends - celery.backends" href="celery.backends.html" />
  22. <link rel="prev" title="Task Discovery - celery.discovery" href="celery.discovery.html" />
  23. </head>
  24. <body>
  25. <div class="related">
  26. <h3>Navigation</h3>
  27. <ul>
  28. <li class="right" style="margin-right: 10px">
  29. <a href="../genindex.html" title="General Index"
  30. accesskey="I">index</a></li>
  31. <li class="right" >
  32. <a href="../modindex.html" title="Global Module Index"
  33. accesskey="M">modules</a> |</li>
  34. <li class="right" >
  35. <a href="celery.backends.html" title="Backends - celery.backends"
  36. accesskey="N">next</a> |</li>
  37. <li class="right" >
  38. <a href="celery.discovery.html" title="Task Discovery - celery.discovery"
  39. accesskey="P">previous</a> |</li>
  40. <li><a href="../index.html">Celery v0.1.14 documentation</a> &raquo;</li>
  41. </ul>
  42. </div>
  43. <div class="document">
  44. <div class="documentwrapper">
  45. <div class="bodywrapper">
  46. <div class="body">
  47. <div class="section" id="module-celery.worker">
  48. <h1>Multiprocessing Worker - celery.worker<a class="headerlink" href="#module-celery.worker" title="Permalink to this headline">¶</a></h1>
  49. <p>celery.worker</p>
  50. <dl class="exception">
  51. <dt id="celery.worker.EmptyQueue">
  52. <em class="property">
  53. exception </em><tt class="descclassname">celery.worker.</tt><tt class="descname">EmptyQueue</tt><a class="headerlink" href="#celery.worker.EmptyQueue" title="Permalink to this definition">¶</a></dt>
  54. <dd>The message queue is currently empty.</dd></dl>
  55. <dl class="class">
  56. <dt id="celery.worker.TaskDaemon">
  57. <em class="property">
  58. class </em><tt class="descclassname">celery.worker.</tt><tt class="descname">TaskDaemon</tt><big>(</big><em>concurrency=None</em>, <em>logfile=None</em>, <em>loglevel=None</em>, <em>queue_wakeup_after=None</em><big>)</big><a class="headerlink" href="#celery.worker.TaskDaemon" title="Permalink to this definition">¶</a></dt>
  59. <dd><p>Executes tasks waiting in the task queue.</p>
  60. <p><tt class="docutils literal"><span class="pre">concurrency</span></tt> is the number of simultaneous processes.</p>
  61. <dl class="method">
  62. <dt id="celery.worker.TaskDaemon.run">
  63. <tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.worker.TaskDaemon.run" title="Permalink to this definition">¶</a></dt>
  64. <dd>The worker server&#8217;s main loop.</dd></dl>
  65. <dl class="method">
  66. <dt id="celery.worker.TaskDaemon.run_periodic_tasks">
  67. <tt class="descname">run_periodic_tasks</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.worker.TaskDaemon.run_periodic_tasks" title="Permalink to this definition">¶</a></dt>
  68. <dd><p>Schedule all waiting periodic tasks for execution.</p>
  69. <p>Returns list of <tt class="xref docutils literal"><span class="pre">celery.models.PeriodicTaskMeta</span></tt> objects.</p>
  70. </dd></dl>
  71. <dl class="method">
  72. <dt id="celery.worker.TaskDaemon.schedule_retry_tasks">
  73. <tt class="descname">schedule_retry_tasks</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.worker.TaskDaemon.schedule_retry_tasks" title="Permalink to this definition">¶</a></dt>
  74. <dd>Reschedule all requeued tasks waiting for retry.</dd></dl>
  75. </dd></dl>
  76. <dl class="class">
  77. <dt id="celery.worker.TaskWrapper">
  78. <em class="property">
  79. class </em><tt class="descclassname">celery.worker.</tt><tt class="descname">TaskWrapper</tt><big>(</big><em>task_name</em>, <em>task_id</em>, <em>task_func</em>, <em>args</em>, <em>kwargs</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper" title="Permalink to this definition">¶</a></dt>
  80. <dd><p>Class defining a task to be run.</p>
  81. <dl class="method">
  82. <dt id="celery.worker.TaskWrapper.execute">
  83. <tt class="descname">execute</tt><big>(</big><em>loglevel</em>, <em>logfile</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper.execute" title="Permalink to this definition">¶</a></dt>
  84. <dd>Execute the task in a <tt class="docutils literal"><span class="pre">jail()</span></tt> and store its result and status
  85. in the task meta backend.</dd></dl>
  86. <dl class="method">
  87. <dt id="celery.worker.TaskWrapper.execute_using_pool">
  88. <tt class="descname">execute_using_pool</tt><big>(</big><em>pool</em>, <em>loglevel</em>, <em>logfile</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper.execute_using_pool" title="Permalink to this definition">¶</a></dt>
  89. <dd>Like <tt class="docutils literal"><span class="pre">execute</span></tt>, but using the <tt class="docutils literal"><span class="pre">multiprocessing</span></tt> pool.</dd></dl>
  90. <dl class="method">
  91. <dt id="celery.worker.TaskWrapper.extend_kwargs_with_logging">
  92. <tt class="descname">extend_kwargs_with_logging</tt><big>(</big><em>loglevel</em>, <em>logfile</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper.extend_kwargs_with_logging" title="Permalink to this definition">¶</a></dt>
  93. <dd><p>Extend the tasks keyword arguments with standard task arguments.</p>
  94. <p>These are <tt class="docutils literal"><span class="pre">logfile</span></tt>, <tt class="docutils literal"><span class="pre">loglevel</span></tt>, <tt class="docutils literal"><span class="pre">task_id</span></tt> and <tt class="docutils literal"><span class="pre">task_name</span></tt>.</p>
  95. </dd></dl>
  96. <dl class="classmethod">
  97. <dt id="celery.worker.TaskWrapper.from_message">
  98. <em class="property">
  99. classmethod </em><tt class="descname">from_message</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper.from_message" title="Permalink to this definition">¶</a></dt>
  100. <dd>Create a TaskWrapper from a message returned by
  101. <a title="celery.messaging.TaskConsumer" class="reference external" href="celery.messaging.html#celery.messaging.TaskConsumer"><tt class="xref docutils literal"><span class="pre">celery.messaging.TaskConsumer</span></tt></a>.</dd></dl>
  102. </dd></dl>
  103. <dl class="exception">
  104. <dt id="celery.worker.UnknownTask">
  105. <em class="property">
  106. exception </em><tt class="descclassname">celery.worker.</tt><tt class="descname">UnknownTask</tt><a class="headerlink" href="#celery.worker.UnknownTask" title="Permalink to this definition">¶</a></dt>
  107. <dd>Got an unknown task in the queue. The message is requeued and
  108. ignored.</dd></dl>
  109. <dl class="function">
  110. <dt id="celery.worker.jail">
  111. <tt class="descclassname">celery.worker.</tt><tt class="descname">jail</tt><big>(</big><em>task_id</em>, <em>callable_</em>, <em>args</em>, <em>kwargs</em><big>)</big><a class="headerlink" href="#celery.worker.jail" title="Permalink to this definition">¶</a></dt>
  112. <dd>Wraps the task in a jail which saves the status and result
  113. of the task execution to the task meta backend.</dd></dl>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="sphinxsidebar">
  119. <div class="sphinxsidebarwrapper">
  120. <h4>Previous topic</h4>
  121. <p class="topless"><a href="celery.discovery.html"
  122. title="previous chapter">Task Discovery - celery.discovery</a></p>
  123. <h4>Next topic</h4>
  124. <p class="topless"><a href="celery.backends.html"
  125. title="next chapter">Backends - celery.backends</a></p>
  126. <h3>This Page</h3>
  127. <ul class="this-page-menu">
  128. <li><a href="../sources/reference/celery.worker.txt"
  129. rel="nofollow">Show Source</a></li>
  130. </ul>
  131. <div id="searchbox" style="display: none">
  132. <h3>Quick search</h3>
  133. <form class="search" action="../search.html" method="get">
  134. <input type="text" name="q" size="18" />
  135. <input type="submit" value="Go" />
  136. <input type="hidden" name="check_keywords" value="yes" />
  137. <input type="hidden" name="area" value="default" />
  138. </form>
  139. <p class="searchtip" style="font-size: 90%">
  140. Enter search terms or a module, class or function name.
  141. </p>
  142. </div>
  143. <script type="text/javascript">$('#searchbox').show(0);</script>
  144. </div>
  145. </div>
  146. <div class="clearer"></div>
  147. </div>
  148. <div class="related">
  149. <h3>Navigation</h3>
  150. <ul>
  151. <li class="right" style="margin-right: 10px">
  152. <a href="../genindex.html" title="General Index"
  153. >index</a></li>
  154. <li class="right" >
  155. <a href="../modindex.html" title="Global Module Index"
  156. >modules</a> |</li>
  157. <li class="right" >
  158. <a href="celery.backends.html" title="Backends - celery.backends"
  159. >next</a> |</li>
  160. <li class="right" >
  161. <a href="celery.discovery.html" title="Task Discovery - celery.discovery"
  162. >previous</a> |</li>
  163. <li><a href="../index.html">Celery v0.1.14 documentation</a> &raquo;</li>
  164. </ul>
  165. </div>
  166. <div class="footer">
  167. &copy; Copyright 2009, Ask Solem.
  168. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
  169. </div>
  170. </body>
  171. </html>