README.rst 10 KB

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