README.rst 10 KB

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