README.rst 10 KB

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