README.rst 10 KB

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