README.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. =================================
  2. celery - Distributed Task Queue
  3. =================================
  4. .. image:: http://cloud.github.com/downloads/ask/celery/celery_favicon_128.png
  5. :Version: 1.0.0-pre2
  6. :Keywords: task queue, job queue, asynchronous, rabbitmq, amqp, redis,
  7. django, python, webhooks, queue, distributed
  8. --
  9. Celery is a task queue/job queue based on distributed message passing.
  10. It is focused on real-time operation, but has support for scheduling as well.
  11. The execution units, called tasks, are executed concurrently on one or more
  12. worker servers, asynchronously (in the background) or synchronously
  13. (wait until ready).
  14. Celery is already used in production to process millions of tasks a day.
  15. It was first created for Django, but is now usable from Python as well.
  16. It can also `operate with other languages via HTTP+JSON`_.
  17. .. _`operate with other languages via HTTP+JSON`: http://bit.ly/CgXSc
  18. Overview
  19. ========
  20. This is a high level overview of the architecture.
  21. .. image:: http://cloud.github.com/downloads/ask/celery/Celery-Overview-v4.jpg
  22. The broker pushes tasks to the worker servers.
  23. A worker server is a networked machine running ``celeryd``. This can be one or
  24. more machines, depending on the workload.
  25. The result of the task can be stored for later retrieval (called its
  26. "tombstone").
  27. Example
  28. =======
  29. You probably want to see some code by now, so I'll give you an example task
  30. adding two numbers:
  31. ::
  32. from celery.decorators import task
  33. @task
  34. def add(x, y):
  35. return x + y
  36. You can execute the task in the background, or wait for it to finish::
  37. >>> result = add.delay(4, 4)
  38. >>> result.wait() # wait for and return the result
  39. 8
  40. Simple!
  41. Features
  42. ========
  43. +-----------------+----------------------------------------------------+
  44. | Messaging | Supported brokers include `RabbitMQ`_, `Stomp`_, |
  45. | | `Redis`_, and the most common SQL databases. |
  46. +-----------------+----------------------------------------------------+
  47. | Robust | Using `RabbitMQ`, celery survives most error |
  48. | | scenarios, and your tasks will never be lost. |
  49. +-----------------+----------------------------------------------------+
  50. | Distributed | Runs on one or more machines. Supports |
  51. | | `clustering`_ when used in combination with |
  52. | | `RabbitMQ`_. You can set up new workers without |
  53. | | central configuration (e.g. use your dads laptop |
  54. | | while the queue is temporarily overloaded). |
  55. +-----------------+----------------------------------------------------+
  56. | Concurrency | Tasks are executed in parallel using the |
  57. | | ``multiprocessing`` module. |
  58. +-----------------+----------------------------------------------------+
  59. | Scheduling | Supports recurring tasks like cron, or specifying |
  60. | | an exact date or countdown for when after the task |
  61. | | should be executed. |
  62. +-----------------+----------------------------------------------------+
  63. | Performance | Able to execute tasks while the user waits. |
  64. +-----------------+----------------------------------------------------+
  65. | Return Values | Task return values can be saved to the selected |
  66. | | result store backend. You can wait for the result, |
  67. | | retrieve it later, or ignore it. |
  68. +-----------------+----------------------------------------------------+
  69. | Result Stores | Database, `MongoDB`_, `Redis`_, `Tokyo Tyrant`, |
  70. | | `AMQP`_ (high performance). |
  71. +-----------------+----------------------------------------------------+
  72. | Webhooks | Your tasks can also be HTTP callbacks, enabling |
  73. | | cross-language communication. |
  74. +-----------------+----------------------------------------------------+
  75. | Rate limiting | Supports rate limiting by using the token bucket |
  76. | | algorithm, which accounts for bursts of traffic. |
  77. | | Rate limits can be set for each task type, or |
  78. | | globally for all. |
  79. +-----------------+----------------------------------------------------+
  80. | Routing | Using AMQP you can route tasks arbitrarily to |
  81. | | different workers. |
  82. +-----------------+----------------------------------------------------+
  83. | Remote-control | You can rate limit and delete (revoke) tasks |
  84. | | remotely. |
  85. +-----------------+----------------------------------------------------+
  86. | Monitoring | You can capture everything happening with the |
  87. | | workers in real-time by subscribing to events. |
  88. | | A real-time web monitor is in development. |
  89. +-----------------+----------------------------------------------------+
  90. | Serialization | Supports Pickle, JSON, YAML, or easily defined |
  91. | | custom schemes. One task invocation can have a |
  92. | | different scheme than another. |
  93. +-----------------+----------------------------------------------------+
  94. | Tracebacks | Errors and tracebacks are stored and can be |
  95. | | investigated after the fact. |
  96. +-----------------+----------------------------------------------------+
  97. | UUID | Every task has an UUID (Universally Unique |
  98. | | Identifier), which is the task id used to query |
  99. | | task status and return value. |
  100. +-----------------+----------------------------------------------------+
  101. | Retries | Tasks can be retried if they fail, with |
  102. | | configurable maximum number of retries, and delays |
  103. | | between each retry. |
  104. +-----------------+----------------------------------------------------+
  105. | Task Sets | A Task set is a task consisting of several |
  106. | | sub-tasks. You can find out how many, or if all |
  107. | | of the sub-tasks has been executed, and even |
  108. | | retrieve the results in order. Progress bars, |
  109. | | anyone? |
  110. +-----------------+----------------------------------------------------+
  111. | Made for Web | You can query status and results via URLs, |
  112. | | enabling the ability to poll task status using |
  113. | | Ajax. |
  114. +-----------------+----------------------------------------------------+
  115. | Error e-mails | Can be configured to send e-mails to the |
  116. | | administrators when tasks fails. |
  117. +-----------------+----------------------------------------------------+
  118. | Supervised | Pool workers are supervised and automatically |
  119. | | replaced if they crash. |
  120. +-----------------+----------------------------------------------------+
  121. .. _`RabbitMQ`: http://www.rabbitmq.com/
  122. .. _`clustering`: http://www.rabbitmq.com/clustering.html
  123. .. _`AMQP`: http://www.amqp.org/
  124. .. _`Stomp`: http://stomp.codehaus.org/
  125. .. _`MongoDB`: http://www.mongodb.org/
  126. .. _`Redis`: http://code.google.com/p/redis/
  127. .. _`Tokyo Tyrant`: http://tokyocabinet.sourceforge.net/
  128. Documentation
  129. =============
  130. The `latest documentation`_ with user guides, tutorials and API reference
  131. is hosted at Github.
  132. .. _`latest documentation`: http://ask.github.com/celery/
  133. Installation
  134. =============
  135. You can install ``celery`` either via the Python Package Index (PyPI)
  136. or from source.
  137. To install using ``pip``,::
  138. $ pip install celery
  139. To install using ``easy_install``,::
  140. $ easy_install celery
  141. Downloading and installing from source
  142. --------------------------------------
  143. Download the latest version of ``celery`` from
  144. http://pypi.python.org/pypi/celery/
  145. You can install it by doing the following,::
  146. $ tar xvfz celery-0.0.0.tar.gz
  147. $ cd celery-0.0.0
  148. $ python setup.py build
  149. # python setup.py install # as root
  150. Using the development version
  151. ------------------------------
  152. You can clone the repository by doing the following::
  153. $ git clone git://github.com/ask/celery.git
  154. Getting Help
  155. ============
  156. Mailing list
  157. ------------
  158. For discussions about the usage, development, and future of celery,
  159. please join the `celery-users`_ mailing list.
  160. .. _`celery-users`: http://groups.google.com/group/celery-users/
  161. IRC
  162. ---
  163. Come chat with us on IRC. The `#celery`_ channel is located at the `Freenode`_
  164. network.
  165. .. _`#celery`: irc://irc.freenode.net/celery
  166. .. _`Freenode`: http://freenode.net
  167. Bug tracker
  168. ===========
  169. If you have any suggestions, bug reports or annoyances please report them
  170. to our issue tracker at http://github.com/ask/celery/issues/
  171. Contributing
  172. ============
  173. Development of ``celery`` happens at Github: http://github.com/ask/celery
  174. You are highly encouraged to participate in the development
  175. of ``celery``. If you don't like Github (for some reason) you're welcome
  176. to send regular patches.
  177. License
  178. =======
  179. This software is licensed under the ``New BSD License``. See the ``LICENSE``
  180. file in the top distribution directory for the full license text.
  181. .. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround