celery.monitoring.html 19 KB

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