introduction.txt 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. :Version: 4.0.0rc3 (0today8)
  2. :Web: http://celeryproject.org/
  3. :Download: http://pypi.python.org/pypi/celery/
  4. :Source: https://github.com/celery/celery/
  5. :Keywords: task queue, job queue, asynchronous, async, rabbitmq, amqp, redis,
  6. python, webhooks, queue, distributed
  7. --
  8. What's a Task Queue?
  9. ====================
  10. Task queues are used as a mechanism to distribute work across threads or
  11. machines.
  12. A task queue's input is a unit of work, called a task, dedicated worker
  13. processes then constantly monitor the queue for new work to perform.
  14. Celery communicates via messages, usually using a broker
  15. to mediate between clients and workers. To initiate a task a client puts a
  16. message on the queue, the broker then delivers the message to a worker.
  17. A Celery system can consist of multiple workers and brokers, giving way
  18. to high availability and horizontal scaling.
  19. Celery is written in Python, but the protocol can be implemented in any
  20. language. In addition to Python there's node-celery_ for Node.js,
  21. and a `PHP client`_.
  22. Language interoperability can also be achieved
  23. by `using webhooks`_.
  24. .. _node-celery: https://github.com/mher/node-celery
  25. .. _`PHP client`: https://github.com/gjedeer/celery-php
  26. .. _`using webhooks`:
  27. http://docs.celeryproject.org/en/latest/userguide/remote-tasks.html
  28. What do I need?
  29. ===============
  30. Celery version 4.0 runs on,
  31. - Python (2.7, 3.4, 3.5)
  32. - PyPy (5.1, 2.4)
  33. This is the last version to support Python 2.7,
  34. and from the next version (Celery 5.x) Python 3.6 or newer is required.
  35. If you're running an older version of Python, you need to be running
  36. an older version of Celery:
  37. - Python 2.6: Celery series 3.1 or earlier.
  38. - Python 2.5: Celery series 3.0 or earlier.
  39. - Python 2.4 was Celery series 2.2 or earlier.
  40. Celery is a project with minimal funding,
  41. so we don't support Microsoft Windows.
  42. Please don't open any issues related to that platform.
  43. *Celery* is usually used with a message broker to send and receive messages.
  44. The RabbitMQ, Redis transports are feature complete,
  45. but there's also experimental support for a myriad of other solutions, including
  46. using SQLite for local development.
  47. *Celery* can run on a single machine, on multiple machines, or even
  48. across datacenters.
  49. Get Started
  50. ===========
  51. If this is the first time you're trying to use Celery, or you're
  52. new to Celery 4.0 coming from previous versions then you should read our
  53. getting started tutorials:
  54. - `First steps with Celery`_
  55. Tutorial teaching you the bare minimum needed to get started with Celery.
  56. - `Next steps`_
  57. A more complete overview, showing more features.
  58. .. _`First steps with Celery`:
  59. http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html
  60. .. _`Next steps`:
  61. http://docs.celeryproject.org/en/latest/getting-started/next-steps.html
  62. Celery is…
  63. ==========
  64. - **Simple**
  65. Celery is easy to use and maintain, and does *not need configuration files*.
  66. It has an active, friendly community you can talk to for support,
  67. like at our `mailing-list`_, or the IRC channel.
  68. Here's one of the simplest applications you can make::
  69. from celery import Celery
  70. app = Celery('hello', broker='amqp://guest@localhost//')
  71. @app.task
  72. def hello():
  73. return 'hello world'
  74. - **Highly Available**
  75. Workers and clients will automatically retry in the event
  76. of connection loss or failure, and some brokers support
  77. HA in way of *Primary/Primary* or *Primary/Replica* replication.
  78. - **Fast**
  79. A single Celery process can process millions of tasks a minute,
  80. with sub-millisecond round-trip latency (using RabbitMQ,
  81. py-librabbitmq, and optimized settings).
  82. - **Flexible**
  83. Almost every part of *Celery* can be extended or used on its own,
  84. Custom pool implementations, serializers, compression schemes, logging,
  85. schedulers, consumers, producers, broker transports, and much more.
  86. It supports…
  87. ============
  88. - **Message Transports**
  89. - RabbitMQ_, Redis_, Amazon SQS
  90. - **Concurrency**
  91. - Prefork, Eventlet_, gevent_, single threaded (``solo``)
  92. - **Result Stores**
  93. - AMQP, Redis
  94. - memcached
  95. - SQLAlchemy, Django ORM
  96. - Apache Cassandra, IronCache, Elasticsearch
  97. - **Serialization**
  98. - *pickle*, *json*, *yaml*, *msgpack*.
  99. - *zlib*, *bzip2* compression.
  100. - Cryptographic message signing.
  101. .. _`Eventlet`: http://eventlet.net/
  102. .. _`gevent`: http://gevent.org/
  103. .. _RabbitMQ: http://rabbitmq.com
  104. .. _Redis: http://redis.io
  105. .. _SQLAlchemy: http://sqlalchemy.org
  106. Framework Integration
  107. =====================
  108. Celery is easy to integrate with web frameworks, some of which even have
  109. integration packages:
  110. +--------------------+------------------------+
  111. | `Django`_ | not needed |
  112. +--------------------+------------------------+
  113. | `Pyramid`_ | `pyramid_celery`_ |
  114. +--------------------+------------------------+
  115. | `Pylons`_ | `celery-pylons`_ |
  116. +--------------------+------------------------+
  117. | `Flask`_ | not needed |
  118. +--------------------+------------------------+
  119. | `web2py`_ | `web2py-celery`_ |
  120. +--------------------+------------------------+
  121. | `Tornado`_ | `tornado-celery`_ |
  122. +--------------------+------------------------+
  123. The integration packages aren't strictly necessary, but they can make
  124. development easier, and sometimes they add important hooks like closing
  125. database connections at ``fork``.
  126. .. _`Django`: http://djangoproject.com/
  127. .. _`Pylons`: http://pylonsproject.org/
  128. .. _`Flask`: http://flask.pocoo.org/
  129. .. _`web2py`: http://web2py.com/
  130. .. _`Bottle`: http://bottlepy.org/
  131. .. _`Pyramid`: http://docs.pylonsproject.org/en/latest/docs/pyramid.html
  132. .. _`pyramid_celery`: http://pypi.python.org/pypi/pyramid_celery/
  133. .. _`django-celery`: http://pypi.python.org/pypi/django-celery
  134. .. _`celery-pylons`: http://pypi.python.org/pypi/celery-pylons
  135. .. _`web2py-celery`: http://code.google.com/p/web2py-celery/
  136. .. _`Tornado`: http://www.tornadoweb.org/
  137. .. _`tornado-celery`: https://github.com/mher/tornado-celery/
  138. .. _celery-documentation:
  139. Documentation
  140. =============
  141. The `latest documentation`_ is hosted at Read The Docs, containing user guides,
  142. tutorials, and an API reference.
  143. .. _`latest documentation`: http://docs.celeryproject.org/en/latest/