celery.monitoring.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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>Statistics and Monitoring - celery.monitoring &mdash; Celery v0.3.10 (unstable) documentation</title>
  7. <link rel="stylesheet" href="../static/agogo.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.3.10 (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.3.10 (unstable) documentation" href="../index.html" />
  21. </head>
  22. <body>
  23. <div class="header-wrapper">
  24. <div class="header">
  25. <h1><a href="../index.html">Celery v0.3.10 (unstable) documentation</a></h1>
  26. <div class="rel">
  27. <a href="../genindex.html" title="General Index"
  28. accesskey="I">index</a> |
  29. <a href="../modindex.html" title="Global Module Index"
  30. accesskey="M">modules</a>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="content-wrapper">
  35. <div class="content">
  36. <div class="document">
  37. <div class="documentwrapper">
  38. <div class="bodywrapper">
  39. <div class="body">
  40. <div class="section" id="module-celery.monitoring">
  41. <h1>Statistics and Monitoring - celery.monitoring<a class="headerlink" href="#module-celery.monitoring" title="Permalink to this headline">¶</a></h1>
  42. <p>Publishing Statistics and Monitoring Celery.</p>
  43. <dl class="class">
  44. <dt id="celery.monitoring.Statistics">
  45. <em class="property">
  46. class </em><tt class="descclassname">celery.monitoring.</tt><tt class="descname">Statistics</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics" title="Permalink to this definition">¶</a></dt>
  47. <dd><p>Base class for classes publishing celery statistics.</p>
  48. <dl class="attribute">
  49. <dt id="celery.monitoring.Statistics.type">
  50. <tt class="descname">type</tt><a class="headerlink" href="#celery.monitoring.Statistics.type" title="Permalink to this definition">¶</a></dt>
  51. <dd><strong>REQUIRED</strong> The type of statistics this class handles.</dd></dl>
  52. <p><strong>Required handlers</strong></p>
  53. <dl class="method">
  54. <dt id="celery.monitoring.Statistics.on_start">
  55. <tt class="descname">on_start</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics.on_start" title="Permalink to this definition">¶</a></dt>
  56. <dd>What to do when the <a title="celery.monitoring.Statistics.run" class="reference internal" href="#celery.monitoring.Statistics.run"><tt class="xref docutils literal"><span class="pre">run()</span></tt></a> method is called.</dd></dl>
  57. <dl class="method">
  58. <dt id="celery.monitoring.Statistics.on_stop">
  59. <tt class="descname">on_stop</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics.on_stop" title="Permalink to this definition">¶</a></dt>
  60. <dd>What to do when the <a title="celery.monitoring.Statistics.stop" class="reference internal" href="#celery.monitoring.Statistics.stop"><tt class="xref docutils literal"><span class="pre">stop()</span></tt></a> method is called.</dd></dl>
  61. <dl class="method">
  62. <dt id="celery.monitoring.Statistics.publish">
  63. <tt class="descname">publish</tt><big>(</big><em>**data</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics.publish" title="Permalink to this definition">¶</a></dt>
  64. <dd><p>Publish statistics to be collected later by
  65. <a title="celery.monitoring.StatsCollector" class="reference internal" href="#celery.monitoring.StatsCollector"><tt class="xref docutils literal"><span class="pre">StatsCollector</span></tt></a>.</p>
  66. <table class="docutils field-list" frame="void" rules="none">
  67. <col class="field-name" />
  68. <col class="field-body" />
  69. <tbody valign="top">
  70. <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>data</em> &#8211; An arbitrary Python object containing the statistics
  71. to be published.</td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </dd></dl>
  76. <dl class="method">
  77. <dt id="celery.monitoring.Statistics.run">
  78. <tt class="descname">run</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics.run" title="Permalink to this definition">¶</a></dt>
  79. <dd>Start producing statistics.</dd></dl>
  80. <dl class="classmethod">
  81. <dt id="celery.monitoring.Statistics.start">
  82. <em class="property">
  83. classmethod </em><tt class="descname">start</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics.start" title="Permalink to this definition">¶</a></dt>
  84. <dd>Convenience method instantiating and running <a title="celery.monitoring.Statistics.run" class="reference internal" href="#celery.monitoring.Statistics.run"><tt class="xref docutils literal"><span class="pre">run()</span></tt></a> in
  85. one swoop.</dd></dl>
  86. <dl class="method">
  87. <dt id="celery.monitoring.Statistics.stop">
  88. <tt class="descname">stop</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.Statistics.stop" title="Permalink to this definition">¶</a></dt>
  89. <dd>Stop producing and publish statistics.</dd></dl>
  90. </dd></dl>
  91. <dl class="class">
  92. <dt id="celery.monitoring.StatsCollector">
  93. <em class="property">
  94. class </em><tt class="descclassname">celery.monitoring.</tt><tt class="descname">StatsCollector</tt><a class="headerlink" href="#celery.monitoring.StatsCollector" title="Permalink to this definition">¶</a></dt>
  95. <dd><p>Collect and report Celery statistics.</p>
  96. <dl class="docutils">
  97. <dt><strong>NOTE</strong>: Please run only one collector at any time, or your stats</dt>
  98. <dd>will be skewed.</dd>
  99. </dl>
  100. <dl class="attribute">
  101. <dt id="celery.monitoring.StatsCollector.total_tasks_processed">
  102. <tt class="descname">total_tasks_processed</tt><a class="headerlink" href="#celery.monitoring.StatsCollector.total_tasks_processed" title="Permalink to this definition">¶</a></dt>
  103. <dd>The number of tasks executed in total since the first time
  104. <a title="celery.monitoring.StatsCollector.collect" class="reference internal" href="#celery.monitoring.StatsCollector.collect"><tt class="xref docutils literal"><span class="pre">collect()</span></tt></a> was executed on this class instance.</dd></dl>
  105. <dl class="attribute">
  106. <dt id="celery.monitoring.StatsCollector.total_tasks_processed_by_type">
  107. <tt class="descname">total_tasks_processed_by_type</tt><a class="headerlink" href="#celery.monitoring.StatsCollector.total_tasks_processed_by_type" title="Permalink to this definition">¶</a></dt>
  108. <dd>A dictionary of task names and how many times they have been
  109. executed in total since the first time <a title="celery.monitoring.StatsCollector.collect" class="reference internal" href="#celery.monitoring.StatsCollector.collect"><tt class="xref docutils literal"><span class="pre">collect()</span></tt></a> was executed
  110. on this class instance.</dd></dl>
  111. <dl class="attribute">
  112. <dt id="celery.monitoring.StatsCollector.total_task_time_running">
  113. <tt class="descname">total_task_time_running</tt><a class="headerlink" href="#celery.monitoring.StatsCollector.total_task_time_running" title="Permalink to this definition">¶</a></dt>
  114. <dd>The total time, in seconds, it took to process all the tasks executed
  115. since the first time <a title="celery.monitoring.StatsCollector.collect" class="reference internal" href="#celery.monitoring.StatsCollector.collect"><tt class="xref docutils literal"><span class="pre">collect()</span></tt></a> was executed on this class
  116. instance.</dd></dl>
  117. <dl class="attribute">
  118. <dt id="celery.monitoring.StatsCollector.total_task_time_running_by_type">
  119. <tt class="descname">total_task_time_running_by_type</tt><a class="headerlink" href="#celery.monitoring.StatsCollector.total_task_time_running_by_type" title="Permalink to this definition">¶</a></dt>
  120. <dd>A dictionary of task names and their total running time in seconds,
  121. counting all the tasks that has been run since the first time
  122. <a title="celery.monitoring.StatsCollector.collect" class="reference internal" href="#celery.monitoring.StatsCollector.collect"><tt class="xref docutils literal"><span class="pre">collect()</span></tt></a> was executed on this class instance.</dd></dl>
  123. <dl class="docutils">
  124. <dt><strong>NOTE</strong>: You have to run <a title="celery.monitoring.StatsCollector.collect" class="reference internal" href="#celery.monitoring.StatsCollector.collect"><tt class="xref docutils literal"><span class="pre">collect()</span></tt></a> for these attributes</dt>
  125. <dd>to be filled.</dd>
  126. </dl>
  127. <dl class="method">
  128. <dt id="celery.monitoring.StatsCollector.collect">
  129. <tt class="descname">collect</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.monitoring.StatsCollector.collect" title="Permalink to this definition">¶</a></dt>
  130. <dd>Collect any new statistics available since the last time
  131. <a href="#id1"><span class="problematic" id="id2">:methd:`collect`</span></a> was executed.</dd></dl>
  132. <dl class="method">
  133. <dt id="celery.monitoring.StatsCollector.dump_to_cache">
  134. <tt class="descname">dump_to_cache</tt><big>(</big><em>cache_key_prefix='celery-statistics'</em><big>)</big><a class="headerlink" href="#celery.monitoring.StatsCollector.dump_to_cache" title="Permalink to this definition">¶</a></dt>
  135. <dd>Store collected statistics in the cache.</dd></dl>
  136. <dl class="method">
  137. <dt id="celery.monitoring.StatsCollector.report">
  138. <tt class="descname">report</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.monitoring.StatsCollector.report" title="Permalink to this definition">¶</a></dt>
  139. <dd><p>Dump a nice statistics report from the data collected since
  140. the first time <a title="celery.monitoring.StatsCollector.collect" class="reference internal" href="#celery.monitoring.StatsCollector.collect"><tt class="xref docutils literal"><span class="pre">collect()</span></tt></a> was executed on this instance.</p>
  141. <p>It outputs the following information:</p>
  142. <ul>
  143. <li><dl class="first docutils">
  144. <dt>Total processing time by task type and how many times each</dt>
  145. <dd><p class="first last">task has been excuted.</p>
  146. </dd>
  147. </dl>
  148. </li>
  149. <li><p class="first">Total task processing time.</p>
  150. </li>
  151. <li><p class="first">Total number of tasks executed</p>
  152. </li>
  153. </ul>
  154. </dd></dl>
  155. <dl class="method">
  156. <dt id="celery.monitoring.StatsCollector.task_time_running">
  157. <tt class="descname">task_time_running</tt><big>(</big><em>task_id</em>, <em>task_name</em>, <em>args</em>, <em>kwargs</em>, <em>nsecs</em><big>)</big><a class="headerlink" href="#celery.monitoring.StatsCollector.task_time_running" title="Permalink to this definition">¶</a></dt>
  158. <dd><p>Process statistics regarding how long a task has been running
  159. (the :class:TaskTimerStats` class is responsible for sending these).</p>
  160. <table class="docutils field-list" frame="void" rules="none">
  161. <col class="field-name" />
  162. <col class="field-body" />
  163. <tbody valign="top">
  164. <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  165. <li><em>task_id</em> &#8211; The UUID of the task.</li>
  166. <li><em>task_name</em> &#8211; The name of task.</li>
  167. <li><em>args</em> &#8211; The tasks positional arguments.</li>
  168. <li><em>kwargs</em> &#8211; The tasks keyword arguments.</li>
  169. <li><em>nsecs</em> &#8211; The number of seconds (in <tt class="xref docutils literal"><span class="pre">time.time()</span></tt> format)
  170. it took to execute the task.</li>
  171. </ul>
  172. </td>
  173. </tr>
  174. </tbody>
  175. </table>
  176. </dd></dl>
  177. </dd></dl>
  178. <dl class="class">
  179. <dt id="celery.monitoring.TaskTimerStats">
  180. <em class="property">
  181. class </em><tt class="descclassname">celery.monitoring.</tt><tt class="descname">TaskTimerStats</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.TaskTimerStats" title="Permalink to this definition">¶</a></dt>
  182. <dd>Time a running <a title="celery.task.Task" class="reference external" href="celery.task.html#celery.task.Task"><tt class="xref docutils literal"><span class="pre">celery.task.Task</span></tt></a>.</dd></dl>
  183. <dl class="class">
  184. <dt id="celery.monitoring.TimerStats">
  185. <em class="property">
  186. class </em><tt class="descclassname">celery.monitoring.</tt><tt class="descname">TimerStats</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.TimerStats" title="Permalink to this definition">¶</a></dt>
  187. <dd><p>A generic timer producing <tt class="docutils literal"><span class="pre">celery</span></tt> statistics.</p>
  188. <dl class="attribute">
  189. <dt id="celery.monitoring.TimerStats.time_start">
  190. <tt class="descname">time_start</tt><a class="headerlink" href="#celery.monitoring.TimerStats.time_start" title="Permalink to this definition">¶</a></dt>
  191. <dd>The time when this class was instantiated (in <tt class="xref docutils literal"><span class="pre">time.time()</span></tt>
  192. format.)</dd></dl>
  193. <dl class="method">
  194. <dt id="celery.monitoring.TimerStats.on_finish">
  195. <tt class="descname">on_finish</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.monitoring.TimerStats.on_finish" title="Permalink to this definition">¶</a></dt>
  196. <dd><p>What to do when the timers <tt class="xref docutils literal"><span class="pre">stop()</span></tt> method is called.</p>
  197. <table class="docutils field-list" frame="void" rules="none">
  198. <col class="field-name" />
  199. <col class="field-body" />
  200. <tbody valign="top">
  201. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the time in seconds it took between calling <tt class="xref docutils literal"><span class="pre">start()</span></tt> on
  202. this class and <tt class="xref docutils literal"><span class="pre">stop()</span></tt>.</td>
  203. </tr>
  204. </tbody>
  205. </table>
  206. </dd></dl>
  207. <dl class="method">
  208. <dt id="celery.monitoring.TimerStats.on_start">
  209. <tt class="descname">on_start</tt><big>(</big><em>task_id</em>, <em>task_name</em>, <em>args</em>, <em>kwargs</em><big>)</big><a class="headerlink" href="#celery.monitoring.TimerStats.on_start" title="Permalink to this definition">¶</a></dt>
  210. <dd>What to do when the timers <tt class="xref docutils literal"><span class="pre">run()</span></tt> method is called.</dd></dl>
  211. </dd></dl>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. <div class="sidebar">
  218. <h3>Contents</h3>
  219. <ul>
  220. <li class="toctree-l1"><a class="reference external" href="../introduction.html">celery - Distributed Task Queue for Django.</a></li>
  221. <li class="toctree-l1"><a class="reference external" href="../faq.html">Frequently Asked Questions</a></li>
  222. <li class="toctree-l1"><a class="reference external" href="index.html">Module API Reference</a></li>
  223. <li class="toctree-l1"><a class="reference external" href="../changelog.html">Change history</a></li>
  224. </ul>
  225. <h3 style="margin-top: 1.5em;">Search</h3>
  226. <form class="search" action="../search.html" method="get">
  227. <input type="text" name="q" size="18" />
  228. <input type="submit" value="Go" />
  229. <input type="hidden" name="check_keywords" value="yes" />
  230. <input type="hidden" name="area" value="default" />
  231. </form>
  232. <p class="searchtip" style="font-size: 90%">
  233. Enter search terms or a module, class or function name.
  234. </p>
  235. </div>
  236. <div class="clearer"></div>
  237. </div>
  238. </div>
  239. <div class="footer-wrapper">
  240. <div class="footer">
  241. <div class="left">
  242. <a href="../genindex.html" title="General Index"
  243. >index</a> |
  244. <a href="../modindex.html" title="Global Module Index"
  245. >modules</a>
  246. <br/>
  247. <a href="../sources/reference/celery.monitoring.txt"
  248. rel="nofollow">Show Source</a>
  249. </div>
  250. <div class="right">
  251. &copy; Copyright 2009, Ask Solem.<br/>
  252. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
  253. </div>
  254. <div class="clearer"></div>
  255. </div>
  256. </div>
  257. </body>
  258. </html>