README.rst 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. =================================
  2. celery - Distributed Task Queue
  3. =================================
  4. :Version: 1.0.0-pre1
  5. :Keywords: task queue, job queue, asynchronous, rabbitmq, amqp, redis.
  6. --
  7. Celery is a task queue/job queue based on distributed message passing.
  8. It is focused on real-time operation, but has support for scheduling as well.
  9. The execution units, called tasks, are executed concurrently on one or more
  10. worker servers, asynchronously (in the background) or synchronously
  11. (wait until ready).
  12. Celery is already used in production to process millions of tasks a day.
  13. It was first created for Django, but is now usable from Python as well.
  14. It can also `operate with other languages via HTTP+JSON`_.
  15. .. _`operate with other languages via HTTP+JSON`: http://bit.ly/CgXSc
  16. Overview
  17. ========
  18. This is a high level overview of the architecture.
  19. .. image:: http://cloud.github.com/downloads/ask/celery/Celery-Overview-v4.jpg
  20. The broker pushes tasks to the worker servers.
  21. A worker server is a networked machine running ``celeryd``. This can be one or
  22. more machines, depending on the workload.
  23. The result of the task can be stored for later retrieval (called its
  24. "tombstone").
  25. Example
  26. =======
  27. You probably want to see some code by now, so I'll give you an example task
  28. adding two numbers:
  29. .. code-block:: python
  30. from celery.decorators import task
  31. @task
  32. def add(x, y):
  33. return x + y
  34. You can execute the task in the background, or wait for it to finish::
  35. >>> result = add.delay(4, 4)
  36. >>> result.wait() # wait for and return the result
  37. 8
  38. Simple!
  39. Features
  40. ========
  41. * Uses messaging (AMQP: RabbitMQ, ZeroMQ, Qpid) to route tasks to the
  42. worker servers. Experimental support for STOMP (ActiveMQ) is also
  43. available. For simple setups it's also possible to use Redis or an
  44. SQL database as the message queue.
  45. * You can run as many worker servers as you want, and still
  46. be *guaranteed that the task is only executed once.*
  47. * Tasks are executed *concurrently* using the Python 2.6
  48. :mod:`multiprocessing` module (also available as a back-port
  49. to older python versions)
  50. * Supports *periodic tasks*, which makes it a (better) replacement
  51. for cronjobs.
  52. * When a task has been executed, the return value can be stored using
  53. either a MySQL/Oracle/PostgreSQL/SQLite database, Memcached,
  54. `MongoDB`_, `Redis`_ or `Tokyo Tyrant`_ back-end. For high-performance
  55. you can also use AMQP messages to publish results.
  56. * Supports calling tasks over HTTP to support multiple programming
  57. languages and systems.
  58. * Supports several serialization schemes, like pickle, json, yaml and
  59. supports registering custom encodings .
  60. * If the task raises an exception, the exception instance is stored,
  61. instead of the return value, and it's possible to inspect the traceback
  62. after the fact.
  63. * All tasks has a Universally Unique Identifier (UUID), which is the
  64. task id, used for querying task status and return values.
  65. * Tasks can be retried if they fail, with a configurable maximum number
  66. of retries.
  67. * Tasks can be configured to run at a specific time and date in the
  68. future (ETA) or you can set a countdown in seconds for when the
  69. task should be executed.
  70. * Supports *task-sets*, which is a task consisting of several sub-tasks.
  71. You can find out how many, or if all of the sub-tasks has been executed.
  72. Excellent for progress-bar like functionality.
  73. * However, you rarely want to wait for these results in a web-environment.
  74. You'd rather want to use Ajax to poll the task status, which is
  75. available from a URL like ``celery/<task_id>/status/``. This view
  76. returns a JSON-serialized data structure containing the task status,
  77. and the return value if completed, or exception on failure.
  78. * Pool workers are supervised, so if for some reason a worker crashes
  79. it is automatically replaced by a new worker.
  80. * Can be configured to send e-mails to the administrators when a task
  81. fails.
  82. .. _`MongoDB`: http://www.mongodb.org/
  83. .. _`Redis`: http://code.google.com/p/redis/
  84. .. _`Tokyo Tyrant`: http://tokyocabinet.sourceforge.net/
  85. Documentation
  86. =============
  87. The `latest documentation`_ with user guides, tutorials and API reference
  88. is hosted at Github.
  89. .. _`latest documentation`: http://ask.github.com/celery/
  90. Installation
  91. =============
  92. .. include:: installation.txt
  93. A look inside the components
  94. ============================
  95. .. image:: http://cloud.github.com/downloads/ask/celery/Celery1.0-inside-worker.jpg
  96. Getting Help
  97. ============
  98. Mailing list
  99. ------------
  100. For discussions about the usage, development, and future of celery,
  101. please join the `celery-users`_ mailing list.
  102. .. _`celery-users`: http://groups.google.com/group/celery-users/
  103. IRC
  104. ---
  105. Come chat with us on IRC. The `#celery`_ channel is located at the `Freenode`_
  106. network.
  107. .. _`#celery`: irc://irc.freenode.net/celery
  108. .. _`Freenode`: http://freenode.net
  109. Bug tracker
  110. ===========
  111. If you have any suggestions, bug reports or annoyances please report them
  112. to our issue tracker at http://github.com/ask/celery/issues/
  113. Contributing
  114. ============
  115. Development of ``celery`` happens at Github: http://github.com/ask/celery
  116. You are highly encouraged to participate in the development
  117. of ``celery``. If you don't like Github (for some reason) you're welcome
  118. to send regular patches.
  119. License
  120. =======
  121. This software is licensed under the ``New BSD License``. See the ``LICENSE``
  122. file in the top distribution directory for the full license text.
  123. .. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround