celery.utils.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.4.13 (stable) 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.4.13 (stable)',
  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.4.13 (stable) documentation" href="../index.html" />
  21. <link rel="up" title="Module API Reference" href="index.html" />
  22. <link rel="next" title="Django Views - celery.views" href="celery.views.html" />
  23. <link rel="prev" title="Logging - celery.log" href="celery.log.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.views.html" title="Django Views - celery.views"
  37. accesskey="N">next</a> |</li>
  38. <li class="right" >
  39. <a href="celery.log.html" title="Logging - celery.log"
  40. accesskey="P">previous</a> |</li>
  41. <li><a href="../index.html">Celery v0.4.13 (stable) 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.utils">
  50. <h1>Multiprocessing Worker - celery.worker<a class="headerlink" href="#module-celery.utils" title="Permalink to this headline">¶</a></h1>
  51. <p>Utility functions</p>
  52. <dl class="function">
  53. <dt id="celery.utils.chunks">
  54. <tt class="descclassname">celery.utils.</tt><tt class="descname">chunks</tt><big>(</big><em>it</em>, <em>n</em><big>)</big><a class="headerlink" href="#celery.utils.chunks" title="Permalink to this definition">¶</a></dt>
  55. <dd><p>Split an iterator into chunks with <tt class="docutils literal"><span class="pre">n</span></tt> elements each.</p>
  56. <p>Examples</p>
  57. <blockquote>
  58. <p># n == 2
  59. &gt;&gt;&gt; x = chunks(iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 2)
  60. &gt;&gt;&gt; list(x)
  61. [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10]]</p>
  62. <p># n == 3
  63. &gt;&gt;&gt; x = chunks(iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 3)
  64. &gt;&gt;&gt; list(x)
  65. [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10]]</p>
  66. </blockquote>
  67. </dd></dl>
  68. <dl class="function">
  69. <dt id="celery.utils.gen_unique_id">
  70. <tt class="descclassname">celery.utils.</tt><tt class="descname">gen_unique_id</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.utils.gen_unique_id" title="Permalink to this definition">¶</a></dt>
  71. <dd><p>Generate a unique id, having - hopefully - a very small chance of
  72. collission.</p>
  73. <p>For now this is provided by <tt class="xref docutils literal"><span class="pre">uuid.uuid4()</span></tt>.</p>
  74. </dd></dl>
  75. <dl class="function">
  76. <dt id="celery.utils.mitemgetter">
  77. <tt class="descclassname">celery.utils.</tt><tt class="descname">mitemgetter</tt><big>(</big><em>*keys</em><big>)</big><a class="headerlink" href="#celery.utils.mitemgetter" title="Permalink to this definition">¶</a></dt>
  78. <dd>Like <tt class="xref docutils literal"><span class="pre">operator.itemgetter()</span></tt> but returns <cite>None</cite> on missing keys
  79. instead of raising <tt class="xref docutils literal"><span class="pre">KeyError</span></tt>.</dd></dl>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="sphinxsidebar">
  85. <div class="sphinxsidebarwrapper">
  86. <h4>Previous topic</h4>
  87. <p class="topless"><a href="celery.log.html"
  88. title="previous chapter">Logging - celery.log</a></p>
  89. <h4>Next topic</h4>
  90. <p class="topless"><a href="celery.views.html"
  91. title="next chapter">Django Views - celery.views</a></p>
  92. <h3>This Page</h3>
  93. <ul class="this-page-menu">
  94. <li><a href="../sources/reference/celery.utils.txt"
  95. rel="nofollow">Show Source</a></li>
  96. </ul>
  97. <div id="searchbox" style="display: none">
  98. <h3>Quick search</h3>
  99. <form class="search" action="../search.html" method="get">
  100. <input type="text" name="q" size="18" />
  101. <input type="submit" value="Go" />
  102. <input type="hidden" name="check_keywords" value="yes" />
  103. <input type="hidden" name="area" value="default" />
  104. </form>
  105. <p class="searchtip" style="font-size: 90%">
  106. Enter search terms or a module, class or function name.
  107. </p>
  108. </div>
  109. <script type="text/javascript">$('#searchbox').show(0);</script>
  110. </div>
  111. </div>
  112. <div class="clearer"></div>
  113. </div>
  114. <div class="related">
  115. <h3>Navigation</h3>
  116. <ul>
  117. <li class="right" style="margin-right: 10px">
  118. <a href="../genindex.html" title="General Index"
  119. >index</a></li>
  120. <li class="right" >
  121. <a href="../modindex.html" title="Global Module Index"
  122. >modules</a> |</li>
  123. <li class="right" >
  124. <a href="celery.views.html" title="Django Views - celery.views"
  125. >next</a> |</li>
  126. <li class="right" >
  127. <a href="celery.log.html" title="Logging - celery.log"
  128. >previous</a> |</li>
  129. <li><a href="../index.html">Celery v0.4.13 (stable) documentation</a> &raquo;</li>
  130. <li><a href="index.html" >Module API Reference</a> &raquo;</li>
  131. </ul>
  132. </div>
  133. <div class="footer">
  134. &copy; Copyright 2009, Ask Solem.
  135. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
  136. </div>
  137. </body>
  138. </html>