celery.conf.rst 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. ============================
  2. Configuration - celery.conf
  3. ============================
  4. .. contents::
  5. :local:
  6. .. currentmodule:: celery.conf
  7. Queues
  8. ======
  9. .. data:: QUEUES
  10. Queue name/options mapping.
  11. .. data:: DEFAULT_QUEUE
  12. Name of the default queue.
  13. .. data:: DEFAULT_EXCHANGE
  14. Default exchange.
  15. .. data:: DEFAULT_EXCHANGE_TYPE
  16. Default exchange type.
  17. .. data:: DEFAULT_DELIVERY_MODE
  18. Default delivery mode (``"persistent"`` or ``"non-persistent"``).
  19. Default is ``"persistent"``.
  20. .. data:: DEFAULT_ROUTING_KEY
  21. Default routing key used when sending tasks.
  22. .. data:: BROKER_CONNECTION_TIMEOUT
  23. The timeout in seconds before we give up establishing a connection
  24. to the AMQP server.
  25. .. data:: BROADCAST_QUEUE
  26. Name prefix for the queue used when listening for
  27. broadcast messages. The workers hostname will be appended
  28. to the prefix to create the final queue name.
  29. Default is ``"celeryctl"``.
  30. .. data:: BROADCAST_EXCHANGE
  31. Name of the exchange used for broadcast messages.
  32. Default is ``"celeryctl"``.
  33. .. data:: BROADCAST_EXCHANGE_TYPE
  34. Exchange type used for broadcast messages. Default is ``"fanout"``.
  35. .. data:: EVENT_QUEUE
  36. Name of queue used to listen for event messages. Default is
  37. ``"celeryevent"``.
  38. .. data:: EVENT_EXCHANGE
  39. Exchange used to send event messages. Default is ``"celeryevent"``.
  40. .. data:: EVENT_EXCHANGE_TYPE
  41. Exchange type used for the event exchange. Default is ``"topic"``.
  42. .. data:: EVENT_ROUTING_KEY
  43. Routing key used for events. Default is ``"celeryevent"``.
  44. .. data:: EVENT_SERIALIZER
  45. Type of serialization method used to serialize events. Default is
  46. ``"json"``.
  47. .. data:: RESULT_EXCHANGE
  48. Exchange used by the AMQP result backend to publish task results.
  49. Default is ``"celeryresult"``.
  50. Sending E-Mails
  51. ===============
  52. .. data:: CELERY_SEND_TASK_ERROR_EMAILS
  53. If set to ``True``, errors in tasks will be sent to :data:`ADMINS` by e-mail.
  54. .. data:: ADMINS
  55. List of ``(name, email_address)`` tuples for the admins that should
  56. receive error e-mails.
  57. .. data:: SERVER_EMAIL
  58. The e-mail address this worker sends e-mails from.
  59. Default is ``"celery@localhost"``.
  60. .. data:: MAIL_HOST
  61. The mail server to use. Default is ``"localhost"``.
  62. .. data:: MAIL_HOST_USER
  63. Username (if required) to log on to the mail server with.
  64. .. data:: MAIL_HOST_PASSWORD
  65. Password (if required) to log on to the mail server with.
  66. .. data:: MAIL_PORT
  67. The port the mail server is listening on. Default is ``25``.
  68. Execution
  69. =========
  70. .. data:: ALWAYS_EAGER
  71. Always execute tasks locally, don't send to the queue.
  72. .. data:: EAGER_PROPAGATES_EXCEPTIONS
  73. If set to ``True``, :func:`celery.execute.apply` will re-raise task exceptions.
  74. It's the same as always running apply with ``throw=True``.
  75. .. data:: TASK_RESULT_EXPIRES
  76. Task tombstone expire time in seconds.
  77. .. data:: IGNORE_RESULT
  78. If enabled, the default behavior will be to not store task results.
  79. .. data:: TRACK_STARTED
  80. If enabled, the default behavior will be to track when tasks starts by
  81. storing the :const:`STARTED` state.
  82. .. data:: ACKS_LATE
  83. If enabled, the default behavior will be to acknowledge task messages
  84. after the task is executed.
  85. .. data:: STORE_ERRORS_EVEN_IF_IGNORED
  86. If enabled, task errors will be stored even though ``Task.ignore_result``
  87. is enabled.
  88. .. data:: MAX_CACHED_RESULTS
  89. Total number of results to store before results are evicted from the
  90. result cache.
  91. .. data:: TASK_SERIALIZER
  92. A string identifying the default serialization
  93. method to use. Can be ``pickle`` (default),
  94. ``json``, ``yaml``, or any custom serialization methods that have
  95. been registered with :mod:`kombu.serialization.registry`.
  96. Default is ``pickle``.
  97. .. data:: RESULT_BACKEND
  98. The backend used to store task results (tombstones).
  99. .. data:: CELERY_CACHE_BACKEND
  100. Celery cache backend.
  101. .. data:: SEND_EVENTS
  102. If set, celery will send events that can be captured by monitors like
  103. ``celerymon``.
  104. Default is: ``False``.
  105. .. data:: DEFAULT_RATE_LIMIT
  106. The default rate limit applied to all tasks which doesn't have a custom
  107. rate limit defined. (Default: :const:`None`)
  108. .. data:: DISABLE_RATE_LIMITS
  109. If ``True`` all rate limits will be disabled and all tasks will be executed
  110. as soon as possible.
  111. Broker
  112. ======
  113. .. data:: BROKER_CONNECTION_RETRY
  114. Automatically try to re-establish the connection to the AMQP broker if
  115. it's lost.
  116. .. data:: BROKER_CONNECTION_MAX_RETRIES
  117. Maximum number of retries before we give up re-establishing a connection
  118. to the broker.
  119. If this is set to ``0`` or :const:`None`, we will retry forever.
  120. Default is ``100`` retries.
  121. Celerybeat
  122. ==========
  123. .. data:: CELERYBEAT_LOG_LEVEL
  124. Default log level for celerybeat.
  125. Default is: ``INFO``.
  126. .. data:: CELERYBEAT_LOG_FILE
  127. Default log file for celerybeat.
  128. Default is: :const:`None` (stderr)
  129. .. data:: CELERYBEAT_SCHEDULE_FILENAME
  130. Name of the persistent schedule database file.
  131. Default is: ``celerybeat-schedule``.
  132. .. data:: CELERYBEAT_MAX_LOOP_INTERVAL
  133. The maximum number of seconds celerybeat is allowed to sleep between
  134. checking the schedule. The default is 5 minutes, which means celerybeat can
  135. only sleep a maximum of 5 minutes after checking the schedule run-times for a
  136. periodic task to apply. If you change the run_times of periodic tasks at
  137. run-time, you may consider lowering this value for changes to take effect
  138. faster (A value of 5 minutes, means the changes will take effect in 5 minutes
  139. at maximum).
  140. Celerymon
  141. =========
  142. .. data:: CELERYMON_LOG_LEVEL
  143. Default log level for celerymon.
  144. Default is: ``INFO``.
  145. .. data:: CELERYMON_LOG_FILE
  146. Default log file for celerymon.
  147. Default is: :const:`None` (stderr)
  148. Celeryd
  149. =======
  150. .. data:: LOG_LEVELS
  151. Mapping of log level names to :mod:`logging` module constants.
  152. .. data:: CELERYD_LOG_FORMAT
  153. The format to use for log messages.
  154. .. data:: CELERYD_TASK_LOG_FORMAT
  155. The format to use for task log messages.
  156. .. data:: CELERYD_LOG_FILE
  157. Filename of the daemon log file.
  158. Default is: :const:`None` (stderr)
  159. .. data:: CELERYD_LOG_LEVEL
  160. Default log level for daemons. (:const:`WARN`)
  161. .. data:: CELERYD_CONCURRENCY
  162. The number of concurrent worker processes.
  163. If set to ``0`` (the default), the total number of available CPUs/cores
  164. will be used.
  165. .. data:: CELERYD_PREFETCH_MULTIPLIER
  166. The number of concurrent workers is multipled by this number to yield
  167. the wanted AMQP QoS message prefetch count.
  168. Default is: ``4``
  169. .. data:: CELERYD_POOL
  170. Name of the task pool class used by the worker.
  171. Default is ``"celery.concurrency.processes.TaskPool"``.
  172. .. data:: CELERYD_CONSUMER
  173. Name of the consumer class used by the worker.
  174. Default is ``"celery.worker.consumer.Consumer"``.
  175. .. data:: CELERYD_MEDIATOR
  176. Name of the mediator class used by the worker.
  177. Default is ``"celery.worker.controllers.Mediator"``.
  178. .. data:: CELERYD_ETA_SCHEDULER
  179. Name of the ETA scheduler class used by the worker.
  180. Default is ``"celery.worker.controllers.ScheduleController"``.