configuration.rst 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665
  1. .. _configuration:
  2. ============================
  3. Configuration and defaults
  4. ============================
  5. This document describes the configuration options available.
  6. If you're using the default loader, you must create the :file:`celeryconfig.py`
  7. module and make sure it is available on the Python path.
  8. .. contents::
  9. :local:
  10. :depth: 2
  11. .. _conf-example:
  12. Example configuration file
  13. ==========================
  14. This is an example configuration file to get you started.
  15. It should contain all you need to run a basic Celery set-up.
  16. .. code-block:: python
  17. ## Broker settings.
  18. BROKER_URL = "amqp://guest:guest@localhost:5672//"
  19. # List of modules to import when celery starts.
  20. CELERY_IMPORTS = ("myapp.tasks", )
  21. ## Using the database to store task state and results.
  22. CELERY_RESULT_BACKEND = "database"
  23. CELERY_RESULT_DBURI = "sqlite:///mydatabase.db"
  24. CELERY_ANNOTATIONS = {"tasks.add": {"rate_limit": "10/s"}}
  25. Configuration Directives
  26. ========================
  27. .. _conf-datetime:
  28. Time and date settings
  29. ----------------------
  30. .. setting:: CELERY_ENABLE_UTC
  31. CELERY_ENABLE_UTC
  32. ~~~~~~~~~~~~~~~~~
  33. If enabled dates and times in messages will be converted to use
  34. the UTC timezone.
  35. Note that workers running Celery versions below 2.5 will assume a local
  36. timezone for all messages, so only enable if all workers have been
  37. upgraded.
  38. Disabled by default. UTC will be enabled by default in version 3.0.
  39. .. setting:: CELERY_TIMEZONE
  40. CELERY_TIMEZONE
  41. ---------------
  42. Configure Celery to use a custom time zone.
  43. The timezone value can be any time zone supported by the :mod:`pytz`
  44. library. :mod:`pytz` must be installed for the selected zone
  45. to be used.
  46. If not set then the systems default local time zone is used.
  47. .. _conf-tasks:
  48. Task settings
  49. -------------
  50. .. setting:: CELERY_ANNOTATIONS
  51. CELERY_ANNOTATIONS
  52. ~~~~~~~~~~~~~~~~~~
  53. This setting can be used to rewrite any task attribute from the
  54. configuration. The setting can be a dict, or a list of annotation
  55. objects that filter for tasks and return a map of attributes
  56. to change.
  57. This will change the ``rate_limit`` attribute for the ``tasks.add``
  58. task:
  59. .. code-block:: python
  60. CELERY_ANNOTATIONS = {"tasks.add": {"rate_limit": "10/s"}}
  61. or change the same for all tasks:
  62. .. code-block:: python
  63. CELERY_ANNOTATIONS = {"*": {"rate_limit": "10/s"}}
  64. You can change methods too, for example the ``on_failure`` handler:
  65. .. code-block:: python
  66. def my_on_failure(self, exc, task_id, args, kwargs, einfo):
  67. print("Oh no! Task failed: %r" % (exc, ))
  68. CELERY_ANNOTATIONS = {"*": {"on_failure": my_on_failure}}
  69. If you need more flexibility then you can use objects
  70. instead of a dict to choose which tasks to annotate:
  71. .. code-block:: python
  72. class MyAnnotate(object):
  73. def annotate(self, task):
  74. if task.name.startswith("tasks."):
  75. return {"rate_limit": "10/s"}
  76. CELERY_ANNOTATIONS = (MyAnnotate(), {...})
  77. .. _conf-concurrency:
  78. Concurrency settings
  79. --------------------
  80. .. setting:: CELERYD_CONCURRENCY
  81. CELERYD_CONCURRENCY
  82. ~~~~~~~~~~~~~~~~~~~
  83. The number of concurrent worker processes/threads/green threads, executing
  84. tasks.
  85. If you're doing mostly I/O you can have more processes,
  86. but if mostly CPU-bound, try to keep it close to the
  87. number of CPUs on your machine. If not set, the number of CPUs/cores
  88. on the host will be used.
  89. Defaults to the number of available CPUs.
  90. .. setting:: CELERYD_PREFETCH_MULTIPLIER
  91. CELERYD_PREFETCH_MULTIPLIER
  92. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  93. How many messages to prefetch at a time multiplied by the number of
  94. concurrent processes. The default is 4 (four messages for each
  95. process). The default setting is usually a good choice, however -- if you
  96. have very long running tasks waiting in the queue and you have to start the
  97. workers, note that the first worker to start will receive four times the
  98. number of messages initially. Thus the tasks may not be fairly distributed
  99. to the workers.
  100. .. _conf-result-backend:
  101. Task result backend settings
  102. ----------------------------
  103. .. setting:: CELERY_RESULT_BACKEND
  104. CELERY_RESULT_BACKEND
  105. ~~~~~~~~~~~~~~~~~~~~~
  106. :Deprecated aliases: ``CELERY_BACKEND``
  107. The backend used to store task results (tombstones).
  108. Disabled by default.
  109. Can be one of the following:
  110. * database
  111. Use a relational database supported by `SQLAlchemy`_.
  112. See :ref:`conf-database-result-backend`.
  113. * cache
  114. Use `memcached`_ to store the results.
  115. See :ref:`conf-cache-result-backend`.
  116. * mongodb
  117. Use `MongoDB`_ to store the results.
  118. See :ref:`conf-mongodb-result-backend`.
  119. * redis
  120. Use `Redis`_ to store the results.
  121. See :ref:`conf-redis-result-backend`.
  122. * amqp
  123. Send results back as AMQP messages
  124. See :ref:`conf-amqp-result-backend`.
  125. * cassandra
  126. Use `Cassandra`_ to store the results.
  127. See :ref:`conf-cassandra-result-backend`.
  128. .. warning:
  129. While the AMQP result backend is very efficient, you must make sure
  130. you only receive the same result once. See :doc:`userguide/executing`).
  131. .. _`SQLAlchemy`: http://sqlalchemy.org
  132. .. _`memcached`: http://memcached.org
  133. .. _`MongoDB`: http://mongodb.org
  134. .. _`Redis`: http://code.google.com/p/redis/
  135. .. _`Cassandra`: http://cassandra.apache.org/
  136. .. setting:: CELERY_RESULT_SERIALIZER
  137. CELERY_RESULT_SERIALIZER
  138. ~~~~~~~~~~~~~~~~~~~~~~~~
  139. Result serialization format. Default is `"pickle"`. See
  140. :ref:`executing-serializers` for information about supported
  141. serialization formats.
  142. .. _conf-database-result-backend:
  143. Database backend settings
  144. -------------------------
  145. .. setting:: CELERY_RESULT_DBURI
  146. CELERY_RESULT_DBURI
  147. ~~~~~~~~~~~~~~~~~~~
  148. Please see `Supported Databases`_ for a table of supported databases.
  149. To use this backend you need to configure it with an
  150. `Connection String`_, some examples include:
  151. .. code-block:: python
  152. # sqlite (filename)
  153. CELERY_RESULT_DBURI = "sqlite:///celerydb.sqlite"
  154. # mysql
  155. CELERY_RESULT_DBURI = "mysql://scott:tiger@localhost/foo"
  156. # postgresql
  157. CELERY_RESULT_DBURI = "postgresql://scott:tiger@localhost/mydatabase"
  158. # oracle
  159. CELERY_RESULT_DBURI = "oracle://scott:tiger@127.0.0.1:1521/sidname"
  160. See `Connection String`_ for more information about connection
  161. strings.
  162. .. setting:: CELERY_RESULT_ENGINE_OPTIONS
  163. CELERY_RESULT_ENGINE_OPTIONS
  164. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  165. To specify additional SQLAlchemy database engine options you can use
  166. the :setting:`CELERY_RESULT_ENGINE_OPTIONS` setting::
  167. # echo enables verbose logging from SQLAlchemy.
  168. CELERY_RESULT_ENGINE_OPTIONS = {"echo": True}
  169. .. setting:: CELERY_RESULT_DB_SHORT_LIVED_SESSIONS
  170. CELERY_RESULT_DB_SHORT_LIVED_SESSIONS = True
  171. Short lived sessions are disabled by default. If enabled they can drastically reduce
  172. performance, especially on systems processing lots of tasks. This option is useful
  173. on low-traffic workers that experience errors as a result of cached database connections
  174. going stale through inactivity. For example, intermittent errors like
  175. `(OperationalError) (2006, 'MySQL server has gone away')` can be fixed by enabling
  176. short lived sessions. This option only affects the database backend.
  177. .. _`Supported Databases`:
  178. http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
  179. .. _`Connection String`:
  180. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  181. Example configuration
  182. ~~~~~~~~~~~~~~~~~~~~~
  183. .. code-block:: python
  184. CELERY_RESULT_BACKEND = "database"
  185. CELERY_RESULT_DBURI = "mysql://user:password@host/dbname"
  186. .. _conf-amqp-result-backend:
  187. AMQP backend settings
  188. ---------------------
  189. .. note::
  190. The AMQP backend requires RabbitMQ 1.1.0 or higher to automatically
  191. expire results. If you are running an older version of RabbitmQ
  192. you should disable result expiration like this:
  193. CELERY_TASK_RESULT_EXPIRES = None
  194. .. setting:: CELERY_RESULT_EXCHANGE
  195. CELERY_RESULT_EXCHANGE
  196. ~~~~~~~~~~~~~~~~~~~~~~
  197. Name of the exchange to publish results in. Default is `"celeryresults"`.
  198. .. setting:: CELERY_RESULT_EXCHANGE_TYPE
  199. CELERY_RESULT_EXCHANGE_TYPE
  200. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201. The exchange type of the result exchange. Default is to use a `direct`
  202. exchange.
  203. .. setting:: CELERY_RESULT_PERSISTENT
  204. CELERY_RESULT_PERSISTENT
  205. ~~~~~~~~~~~~~~~~~~~~~~~~
  206. If set to :const:`True`, result messages will be persistent. This means the
  207. messages will not be lost after a broker restart. The default is for the
  208. results to be transient.
  209. Example configuration
  210. ~~~~~~~~~~~~~~~~~~~~~
  211. .. code-block:: python
  212. CELERY_RESULT_BACKEND = "amqp"
  213. CELERY_TASK_RESULT_EXPIRES = 18000 # 5 hours.
  214. .. _conf-cache-result-backend:
  215. Cache backend settings
  216. ----------------------
  217. .. note::
  218. The cache backend supports the `pylibmc`_ and `python-memcached`
  219. libraries. The latter is used only if `pylibmc`_ is not installed.
  220. .. setting:: CELERY_CACHE_BACKEND
  221. CELERY_CACHE_BACKEND
  222. ~~~~~~~~~~~~~~~~~~~~
  223. Using a single memcached server:
  224. .. code-block:: python
  225. CELERY_CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
  226. Using multiple memcached servers:
  227. .. code-block:: python
  228. CELERY_RESULT_BACKEND = "cache"
  229. CELERY_CACHE_BACKEND = 'memcached://172.19.26.240:11211;172.19.26.242:11211/'
  230. .. setting:: CELERY_CACHE_BACKEND_OPTIONS
  231. The "dummy" backend stores the cache in memory only:
  232. CELERY_CACHE_BACKEND = "dummy"
  233. CELERY_CACHE_BACKEND_OPTIONS
  234. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235. You can set pylibmc options using the :setting:`CELERY_CACHE_BACKEND_OPTIONS`
  236. setting:
  237. .. code-block:: python
  238. CELERY_CACHE_BACKEND_OPTIONS = {"binary": True,
  239. "behaviors": {"tcp_nodelay": True}}
  240. .. _`pylibmc`: http://sendapatch.se/projects/pylibmc/
  241. .. _conf-redis-result-backend:
  242. Redis backend settings
  243. ----------------------
  244. .. note::
  245. The Redis backend requires the :mod:`redis` library:
  246. http://pypi.python.org/pypi/redis/
  247. To install the redis package use `pip` or `easy_install`::
  248. $ pip install redis
  249. This backend requires the following configuration directives to be set.
  250. .. setting:: CELERY_REDIS_HOST
  251. CELERY_REDIS_HOST
  252. ~~~~~~~~~~~~~~~~~
  253. Host name of the Redis database server. e.g. `"localhost"`.
  254. .. setting:: CELERY_REDIS_PORT
  255. CELERY_REDIS_PORT
  256. ~~~~~~~~~~~~~~~~~
  257. Port to the Redis database server. e.g. `6379`.
  258. .. setting:: CELERY_REDIS_DB
  259. CELERY_REDIS_DB
  260. ~~~~~~~~~~~~~~~
  261. Database number to use. Default is 0
  262. .. setting:: CELERY_REDIS_PASSWORD
  263. CELERY_REDIS_PASSWORD
  264. ~~~~~~~~~~~~~~~~~~~~~
  265. Password used to connect to the database.
  266. .. setting:: CELERY_REDIS_MAX_CONNECTIONS
  267. CELERY_REDIS_MAX_CONNECTIONS
  268. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  269. Maximum number of connections available in the Redis connection
  270. pool used for sending and retrieving results.
  271. Example configuration
  272. ~~~~~~~~~~~~~~~~~~~~~
  273. .. code-block:: python
  274. CELERY_RESULT_BACKEND = "redis"
  275. CELERY_REDIS_HOST = "localhost"
  276. CELERY_REDIS_PORT = 6379
  277. CELERY_REDIS_DB = 0
  278. .. _conf-mongodb-result-backend:
  279. MongoDB backend settings
  280. ------------------------
  281. .. note::
  282. The MongoDB backend requires the :mod:`pymongo` library:
  283. http://github.com/mongodb/mongo-python-driver/tree/master
  284. .. setting:: CELERY_MONGODB_BACKEND_SETTINGS
  285. CELERY_MONGODB_BACKEND_SETTINGS
  286. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287. This is a dict supporting the following keys:
  288. * host
  289. Host name of the MongoDB server. Defaults to "localhost".
  290. * port
  291. The port the MongoDB server is listening to. Defaults to 27017.
  292. * user
  293. User name to authenticate to the MongoDB server as (optional).
  294. * password
  295. Password to authenticate to the MongoDB server (optional).
  296. * database
  297. The database name to connect to. Defaults to "celery".
  298. * taskmeta_collection
  299. The collection name to store task meta data.
  300. Defaults to "celery_taskmeta".
  301. .. _example-mongodb-result-config:
  302. Example configuration
  303. ~~~~~~~~~~~~~~~~~~~~~
  304. .. code-block:: python
  305. CELERY_RESULT_BACKEND = "mongodb"
  306. CELERY_MONGODB_BACKEND_SETTINGS = {
  307. "host": "192.168.1.100",
  308. "port": 30000,
  309. "database": "mydb",
  310. "taskmeta_collection": "my_taskmeta_collection",
  311. }
  312. .. _conf-cassandra-result-backend:
  313. Cassandra backend settings
  314. --------------------------
  315. .. note::
  316. The Cassandra backend requires the :mod:`pycassa` library:
  317. http://pypi.python.org/pypi/pycassa/
  318. To install the pycassa package use `pip` or `easy_install`::
  319. $ pip install pycassa
  320. This backend requires the following configuration directives to be set.
  321. .. setting:: CASSANDRA_SERVERS
  322. CASSANDRA_SERVERS
  323. ~~~~~~~~~~~~~~~~~
  324. List of ``host:port`` Cassandra servers. e.g. ``["localhost:9160]"``.
  325. .. setting:: CASSANDRA_KEYSPACE
  326. CASSANDRA_KEYSPACE
  327. ~~~~~~~~~~~~~~~~~~
  328. The keyspace in which to store the results. e.g. ``"tasks_keyspace"``.
  329. .. setting:: CASSANDRA_COLUMN_FAMILY
  330. CASSANDRA_COLUMN_FAMILY
  331. ~~~~~~~~~~~~~~~~~~~~~~~
  332. The column family in which to store the results. eg ``"tasks"``
  333. .. setting:: CASSANDRA_READ_CONSISTENCY
  334. CASSANDRA_READ_CONSISTENCY
  335. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  336. The read consistency used. Values can be ``"ONE"``, ``"QUORUM"`` or ``"ALL"``.
  337. .. setting:: CASSANDRA_WRITE_CONSISTENCY
  338. CASSANDRA_WRITE_CONSISTENCY
  339. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  340. The write consistency used. Values can be ``"ONE"``, ``"QUORUM"`` or ``"ALL"``.
  341. .. setting:: CASSANDRA_DETAILED_MODE
  342. CASSANDRA_DETAILED_MODE
  343. ~~~~~~~~~~~~~~~~~~~~~~~
  344. Enable or disable detailed mode. Default is :const:`False`.
  345. This mode allows to use the power of Cassandra wide columns to
  346. store all states for a task as a wide column, instead of only the last one.
  347. To use this mode, you need to configure your ColumnFamily to
  348. use the ``TimeUUID`` type as a comparator::
  349. create column family task_results with comparator = TimeUUIDType;
  350. Example configuration
  351. ~~~~~~~~~~~~~~~~~~~~~
  352. .. code-block:: python
  353. CASSANDRA_SERVERS = ["localhost:9160"]
  354. CASSANDRA_KEYSPACE = "celery"
  355. CASSANDRA_COLUMN_FAMILY = "task_results"
  356. CASSANDRA_READ_CONSISTENCY = "ONE"
  357. CASSANDRA_WRITE_CONSISTENCY = "ONE"
  358. CASSANDRA_DETAILED_MODE = True
  359. .. _conf-messaging:
  360. Message Routing
  361. ---------------
  362. .. _conf-messaging-routing:
  363. .. setting:: CELERY_QUEUES
  364. CELERY_QUEUES
  365. ~~~~~~~~~~~~~
  366. The mapping of queues the worker consumes from. This is a dictionary
  367. of queue name/options. See :ref:`guide-routing` for more information.
  368. The default is a queue/exchange/binding key of `"celery"`, with
  369. exchange type `direct`.
  370. You don't have to care about this unless you want custom routing facilities.
  371. .. setting:: CELERY_ROUTES
  372. CELERY_ROUTES
  373. ~~~~~~~~~~~~~
  374. A list of routers, or a single router used to route tasks to queues.
  375. When deciding the final destination of a task the routers are consulted
  376. in order. See :ref:`routers` for more information.
  377. .. setting:: CELERY_CREATE_MISSING_QUEUES
  378. CELERY_CREATE_MISSING_QUEUES
  379. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  380. If enabled (default), any queues specified that is not defined in
  381. :setting:`CELERY_QUEUES` will be automatically created. See
  382. :ref:`routing-automatic`.
  383. .. setting:: CELERY_DEFAULT_QUEUE
  384. CELERY_DEFAULT_QUEUE
  385. ~~~~~~~~~~~~~~~~~~~~
  386. The name of the default queue used by `.apply_async` if the message has
  387. no route or no custom queue has been specified.
  388. This queue must be listed in :setting:`CELERY_QUEUES`.
  389. If :setting:`CELERY_QUEUES` is not specified then it this automatically
  390. created containing one queue entry, where this name is used as the name of
  391. that queue.
  392. The default is: `celery`.
  393. .. seealso::
  394. :ref:`routing-changing-default-queue`
  395. .. setting:: CELERY_DEFAULT_EXCHANGE
  396. CELERY_DEFAULT_EXCHANGE
  397. ~~~~~~~~~~~~~~~~~~~~~~~
  398. Name of the default exchange to use when no custom exchange is
  399. specified for a key in the :setting:`CELERY_QUEUES` setting.
  400. The default is: `celery`.
  401. .. setting:: CELERY_DEFAULT_EXCHANGE_TYPE
  402. CELERY_DEFAULT_EXCHANGE_TYPE
  403. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  404. Default exchange type used when no custom exchange type is specified.
  405. for a key in the :setting:`CELERY_QUEUES` setting.
  406. The default is: `direct`.
  407. .. setting:: CELERY_DEFAULT_ROUTING_KEY
  408. CELERY_DEFAULT_ROUTING_KEY
  409. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  410. The default routing key used when no custom routing key
  411. is specified for a key in the :setting:`CELERY_QUEUES` setting.
  412. The default is: `celery`.
  413. .. setting:: CELERY_DEFAULT_DELIVERY_MODE
  414. CELERY_DEFAULT_DELIVERY_MODE
  415. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  416. Can be `transient` or `persistent`. The default is to send
  417. persistent messages.
  418. .. _conf-broker-settings:
  419. Broker Settings
  420. ---------------
  421. .. setting:: BROKER_TRANSPORT
  422. BROKER_TRANSPORT
  423. ~~~~~~~~~~~~~~~~
  424. :Aliases: ``BROKER_BACKEND``
  425. :Deprecated aliases: ``CARROT_BACKEND``
  426. .. setting:: BROKER_URL
  427. BROKER_URL
  428. ~~~~~~~~~~
  429. Default broker URL. This must be an URL in the form of::
  430. transport://userid:password@hostname:port/virtual_host
  431. Only the scheme part (``transport://``) is required, the rest
  432. is optional, and defaults to the specific transports default values.
  433. The transport part is the broker implementation to use, and the
  434. default is ``amqp``, but there are many other choices including
  435. ``librabbitmq``, ``amqplib``, ``redis``, ``beanstalk``,
  436. ``sqlalchemy``, ``django``, ``mongodb``, ``couchdb`` and ``pika``.
  437. It can also be a fully qualified path to your own transport implementation.
  438. See the Kombu documentation for more information about broker URLs.
  439. .. setting:: BROKER_USE_SSL
  440. BROKER_USE_SSL
  441. ~~~~~~~~~~~~~~
  442. Use SSL to connect to the broker. Off by default. This may not be supported
  443. by all transports.
  444. .. setting:: BROKER_POOL_LIMIT
  445. BROKER_POOL_LIMIT
  446. ~~~~~~~~~~~~~~~~~
  447. .. versionadded:: 2.3
  448. The maximum number of connections that can be open in the connection pool.
  449. The pool is enabled by default since version 2.5, with a default limit of ten
  450. connections. This number can be tweaked depending on the number of
  451. threads/greenthreads (eventlet/gevent) using a connection. For example
  452. running eventlet with 1000 greenlets that use a connection to the broker,
  453. contention can arise and you should consider increasing the limit.
  454. If set to :const:`None` or 0 the connection pool will be disabled and
  455. connections will be established and closed for every use.
  456. Default (since 2.5) is to use a pool of 10 connections.
  457. .. setting:: BROKER_CONNECTION_TIMEOUT
  458. BROKER_CONNECTION_TIMEOUT
  459. ~~~~~~~~~~~~~~~~~~~~~~~~~
  460. The default timeout in seconds before we give up establishing a connection
  461. to the AMQP server. Default is 4 seconds.
  462. .. setting:: BROKER_CONNECTION_RETRY
  463. BROKER_CONNECTION_RETRY
  464. ~~~~~~~~~~~~~~~~~~~~~~~
  465. Automatically try to re-establish the connection to the AMQP broker if lost.
  466. The time between retries is increased for each retry, and is
  467. not exhausted before :setting:`BROKER_CONNECTION_MAX_RETRIES` is
  468. exceeded.
  469. This behavior is on by default.
  470. .. setting:: BROKER_CONNECTION_MAX_RETRIES
  471. BROKER_CONNECTION_MAX_RETRIES
  472. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  473. Maximum number of retries before we give up re-establishing a connection
  474. to the AMQP broker.
  475. If this is set to :const:`0` or :const:`None`, we will retry forever.
  476. Default is 100 retries.
  477. .. setting:: BROKER_TRANSPORT_OPTIONS
  478. BROKER_TRANSPORT_OPTIONS
  479. ~~~~~~~~~~~~~~~~~~~~~~~~
  480. .. versionadded:: 2.2
  481. A dict of additional options passed to the underlying transport.
  482. See your transport user manual for supported options (if any).
  483. .. _conf-task-execution:
  484. Task execution settings
  485. -----------------------
  486. .. setting:: CELERY_ALWAYS_EAGER
  487. CELERY_ALWAYS_EAGER
  488. ~~~~~~~~~~~~~~~~~~~
  489. If this is :const:`True`, all tasks will be executed locally by blocking until
  490. the task returns. ``apply_async()`` and ``Task.delay()`` will return
  491. an :class:`~celery.result.EagerResult` instance, which emulates the API
  492. and behavior of :class:`~celery.result.AsyncResult`, except the result
  493. is already evaluated.
  494. That is, tasks will be executed locally instead of being sent to
  495. the queue.
  496. .. setting:: CELERY_EAGER_PROPAGATES_EXCEPTIONS
  497. CELERY_EAGER_PROPAGATES_EXCEPTIONS
  498. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  499. If this is :const:`True`, eagerly executed tasks (applied by `task.apply()`,
  500. or when the :setting:`CELERY_ALWAYS_EAGER` setting is enabled), will
  501. propagate exceptions.
  502. It's the same as always running ``apply()`` with ``throw=True``.
  503. .. setting:: CELERY_IGNORE_RESULT
  504. CELERY_IGNORE_RESULT
  505. ~~~~~~~~~~~~~~~~~~~~
  506. Whether to store the task return values or not (tombstones).
  507. If you still want to store errors, just not successful return values,
  508. you can set :setting:`CELERY_STORE_ERRORS_EVEN_IF_IGNORED`.
  509. .. setting:: CELERY_MESSAGE_COMPRESSION
  510. CELERY_MESSAGE_COMPRESSION
  511. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  512. Default compression used for task messages.
  513. Can be ``"gzip"``, ``"bzip2"`` (if available), or any custom
  514. compression schemes registered in the Kombu compression registry.
  515. The default is to send uncompressed messages.
  516. .. setting:: CELERY_TASK_RESULT_EXPIRES
  517. CELERY_TASK_RESULT_EXPIRES
  518. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  519. Time (in seconds, or a :class:`~datetime.timedelta` object) for when after
  520. stored task tombstones will be deleted.
  521. A built-in periodic task will delete the results after this time
  522. (:class:`celery.task.backend_cleanup`).
  523. .. note::
  524. For the moment this only works with the amqp, database, cache, redis and MongoDB
  525. backends.
  526. When using the database or MongoDB backends, `celerybeat` must be
  527. running for the results to be expired.
  528. .. setting:: CELERY_MAX_CACHED_RESULTS
  529. CELERY_MAX_CACHED_RESULTS
  530. ~~~~~~~~~~~~~~~~~~~~~~~~~
  531. Result backends caches ready results used by the client.
  532. This is the total number of results to cache before older results are evicted.
  533. The default is 5000.
  534. .. setting:: CELERY_TRACK_STARTED
  535. CELERY_TRACK_STARTED
  536. ~~~~~~~~~~~~~~~~~~~~
  537. If :const:`True` the task will report its status as "started" when the
  538. task is executed by a worker. The default value is :const:`False` as
  539. the normal behaviour is to not report that level of granularity. Tasks
  540. are either pending, finished, or waiting to be retried. Having a "started"
  541. state can be useful for when there are long running tasks and there is a
  542. need to report which task is currently running.
  543. .. setting:: CELERY_TASK_SERIALIZER
  544. CELERY_TASK_SERIALIZER
  545. ~~~~~~~~~~~~~~~~~~~~~~
  546. A string identifying the default serialization method to use. Can be
  547. `pickle` (default), `json`, `yaml`, `msgpack` or any custom serialization
  548. methods that have been registered with :mod:`kombu.serialization.registry`.
  549. .. seealso::
  550. :ref:`executing-serializers`.
  551. .. setting:: CELERY_TASK_PUBLISH_RETRY
  552. CELERY_TASK_PUBLISH_RETRY
  553. ~~~~~~~~~~~~~~~~~~~~~~~~~
  554. .. versionadded:: 2.2
  555. Decides if publishing task messages will be retried in the case
  556. of connection loss or other connection errors.
  557. See also :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY`.
  558. Disabled by default.
  559. .. setting:: CELERY_TASK_PUBLISH_RETRY_POLICY
  560. CELERY_TASK_PUBLISH_RETRY_POLICY
  561. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  562. .. versionadded:: 2.2
  563. Defines the default policy when retrying publishing a task message in
  564. the case of connection loss or other connection errors.
  565. This is a mapping that must contain the following keys:
  566. * `max_retries`
  567. Maximum number of retries before giving up, in this case the
  568. exception that caused the retry to fail will be raised.
  569. A value of 0 or :const:`None` means it will retry forever.
  570. The default is to retry 3 times.
  571. * `interval_start`
  572. Defines the number of seconds (float or integer) to wait between
  573. retries. Default is 0, which means the first retry will be
  574. instantaneous.
  575. * `interval_step`
  576. On each consecutive retry this number will be added to the retry
  577. delay (float or integer). Default is 0.2.
  578. * `interval_max`
  579. Maximum number of seconds (float or integer) to wait between
  580. retries. Default is 0.2.
  581. With the default policy of::
  582. {"max_retries": 3,
  583. "interval_start": 0,
  584. "interval_step": 0.2,
  585. "interval_max": 0.2}
  586. the maximum time spent retrying will be 0.4 seconds. It is set relatively
  587. short by default because a connection failure could lead to a retry pile effect
  588. if the broker connection is down: e.g. many web server processes waiting
  589. to retry blocking other incoming requests.
  590. .. setting:: CELERY_DEFAULT_RATE_LIMIT
  591. CELERY_DEFAULT_RATE_LIMIT
  592. ~~~~~~~~~~~~~~~~~~~~~~~~~
  593. The global default rate limit for tasks.
  594. This value is used for tasks that does not have a custom rate limit
  595. The default is no rate limit.
  596. .. setting:: CELERY_DISABLE_RATE_LIMITS
  597. CELERY_DISABLE_RATE_LIMITS
  598. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  599. Disable all rate limits, even if tasks has explicit rate limits set.
  600. .. setting:: CELERY_ACKS_LATE
  601. CELERY_ACKS_LATE
  602. ~~~~~~~~~~~~~~~~
  603. Late ack means the task messages will be acknowledged **after** the task
  604. has been executed, not *just before*, which is the default behavior.
  605. .. seealso::
  606. FAQ: :ref:`faq-acks_late-vs-retry`.
  607. .. _conf-celeryd:
  608. Worker: celeryd
  609. ---------------
  610. .. setting:: CELERY_IMPORTS
  611. CELERY_IMPORTS
  612. ~~~~~~~~~~~~~~
  613. A sequence of modules to import when the celery daemon starts.
  614. This is used to specify the task modules to import, but also
  615. to import signal handlers and additional remote control commands, etc.
  616. .. setting:: CELERY_INCLUDE
  617. CELERY_INCLUDE
  618. ~~~~~~~~~~~~~~
  619. Exact same semantics as :setting:`CELERY_IMPORTS`, but can be used as a means
  620. to have different import categories.
  621. .. setting:: CELERYD_FORCE_EXECV
  622. CELERYD_FORCE_EXECV
  623. ~~~~~~~~~~~~~~~~~~~
  624. On Unix the processes pool will fork, so that child processes
  625. start with the same memory as the parent process.
  626. This can cause problems as there is a known deadlock condition
  627. with pthread locking primitives when `fork()` is combined with threads.
  628. You should enable this setting if you are experiencing hangs (deadlocks),
  629. especially in combination with time limits or having a max tasks per child limit.
  630. This option will be enabled by default in a later version.
  631. This is not a problem on Windows, as it does not have `fork()`.
  632. .. setting:: CELERYD_WORKER_LOST_WAIT
  633. CELERYD_WORKER_LOST_WAIT
  634. ~~~~~~~~~~~~~~~~~~~~~~~~
  635. In some cases a worker may be killed without proper cleanup,
  636. and the worker may have published a result before terminating.
  637. This value specifies how long we wait for any missing results before
  638. raising a :exc:`@WorkerLostError` exception.
  639. Default is 10.0
  640. .. setting:: CELERYD_MAX_TASKS_PER_CHILD
  641. CELERYD_MAX_TASKS_PER_CHILD
  642. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  643. Maximum number of tasks a pool worker process can execute before
  644. it's replaced with a new one. Default is no limit.
  645. .. setting:: CELERYD_TASK_TIME_LIMIT
  646. CELERYD_TASK_TIME_LIMIT
  647. ~~~~~~~~~~~~~~~~~~~~~~~
  648. Task hard time limit in seconds. The worker processing the task will
  649. be killed and replaced with a new one when this is exceeded.
  650. .. setting:: CELERYD_TASK_SOFT_TIME_LIMIT
  651. CELERYD_TASK_SOFT_TIME_LIMIT
  652. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  653. Task soft time limit in seconds.
  654. The :exc:`~@SoftTimeLimitExceeded` exception will be
  655. raised when this is exceeded. The task can catch this to
  656. e.g. clean up before the hard time limit comes.
  657. Example:
  658. .. code-block:: python
  659. from celery.exceptions import SoftTimeLimitExceeded
  660. @celery.task
  661. def mytask():
  662. try:
  663. return do_work()
  664. except SoftTimeLimitExceeded:
  665. cleanup_in_a_hurry()
  666. .. setting:: CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  667. CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  668. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  669. If set, the worker stores all task errors in the result store even if
  670. :attr:`Task.ignore_result <celery.task.base.Task.ignore_result>` is on.
  671. .. setting:: CELERYD_STATE_DB
  672. CELERYD_STATE_DB
  673. ~~~~~~~~~~~~~~~~
  674. Name of the file used to stores persistent worker state (like revoked tasks).
  675. Can be a relative or absolute path, but be aware that the suffix `.db`
  676. may be appended to the file name (depending on Python version).
  677. Can also be set via the :option:`--statedb` argument to
  678. :mod:`~celery.bin.celeryd`.
  679. Not enabled by default.
  680. .. setting:: CELERYD_TIMER_PRECISION
  681. CELERYD_TIMER_PRECISION
  682. ~~~~~~~~~~~~~~~~~~~~~~~
  683. Set the maximum time in seconds that the ETA scheduler can sleep between
  684. rechecking the schedule. Default is 1 second.
  685. Setting this value to 1 second means the schedulers precision will
  686. be 1 second. If you need near millisecond precision you can set this to 0.1.
  687. .. _conf-error-mails:
  688. Error E-Mails
  689. -------------
  690. .. setting:: CELERY_SEND_TASK_ERROR_EMAILS
  691. CELERY_SEND_TASK_ERROR_EMAILS
  692. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  693. The default value for the `Task.send_error_emails` attribute, which if
  694. set to :const:`True` means errors occurring during task execution will be
  695. sent to :setting:`ADMINS` by email.
  696. Disabled by default.
  697. .. setting:: ADMINS
  698. ADMINS
  699. ~~~~~~
  700. List of `(name, email_address)` tuples for the administrators that should
  701. receive error emails.
  702. .. setting:: SERVER_EMAIL
  703. SERVER_EMAIL
  704. ~~~~~~~~~~~~
  705. The email address this worker sends emails from.
  706. Default is celery@localhost.
  707. .. setting:: EMAIL_HOST
  708. EMAIL_HOST
  709. ~~~~~~~~~~
  710. The mail server to use. Default is `"localhost"`.
  711. .. setting:: EMAIL_HOST_USER
  712. EMAIL_HOST_USER
  713. ~~~~~~~~~~~~~~~
  714. User name (if required) to log on to the mail server with.
  715. .. setting:: EMAIL_HOST_PASSWORD
  716. EMAIL_HOST_PASSWORD
  717. ~~~~~~~~~~~~~~~~~~~
  718. Password (if required) to log on to the mail server with.
  719. .. setting:: EMAIL_PORT
  720. EMAIL_PORT
  721. ~~~~~~~~~~
  722. The port the mail server is listening on. Default is `25`.
  723. .. setting:: EMAIL_USE_SSL
  724. EMAIL_USE_SSL
  725. ~~~~~~~~~~~~~
  726. Use SSL when connecting to the SMTP server. Disabled by default.
  727. .. setting:: EMAIL_USE_TLS
  728. EMAIL_USE_TLS
  729. ~~~~~~~~~~~~~
  730. Use TLS when connecting to the SMTP server. Disabled by default.
  731. .. setting:: EMAIL_TIMEOUT
  732. EMAIL_TIMEOUT
  733. ~~~~~~~~~~~~~
  734. Timeout in seconds for when we give up trying to connect
  735. to the SMTP server when sending emails.
  736. The default is 2 seconds.
  737. .. _conf-example-error-mail-config:
  738. Example E-Mail configuration
  739. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  740. This configuration enables the sending of error emails to
  741. george@vandelay.com and kramer@vandelay.com:
  742. .. code-block:: python
  743. # Enables error emails.
  744. CELERY_SEND_TASK_ERROR_EMAILS = True
  745. # Name and email addresses of recipients
  746. ADMINS = (
  747. ("George Costanza", "george@vandelay.com"),
  748. ("Cosmo Kramer", "kosmo@vandelay.com"),
  749. )
  750. # Email address used as sender (From field).
  751. SERVER_EMAIL = "no-reply@vandelay.com"
  752. # Mailserver configuration
  753. EMAIL_HOST = "mail.vandelay.com"
  754. EMAIL_PORT = 25
  755. # EMAIL_HOST_USER = "servers"
  756. # EMAIL_HOST_PASSWORD = "s3cr3t"
  757. .. _conf-events:
  758. Events
  759. ------
  760. .. setting:: CELERY_SEND_EVENTS
  761. CELERY_SEND_EVENTS
  762. ~~~~~~~~~~~~~~~~~~
  763. Send events so the worker can be monitored by tools like `celerymon`.
  764. .. setting:: CELERY_SEND_TASK_SENT_EVENT
  765. CELERY_SEND_TASK_SENT_EVENT
  766. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  767. .. versionadded:: 2.2
  768. If enabled, a `task-sent` event will be sent for every task so tasks can be
  769. tracked before they are consumed by a worker.
  770. Disabled by default.
  771. .. setting:: CELERY_EVENT_SERIALIZER
  772. CELERY_EVENT_SERIALIZER
  773. ~~~~~~~~~~~~~~~~~~~~~~~
  774. Message serialization format used when sending event messages.
  775. Default is `"json"`. See :ref:`executing-serializers`.
  776. .. _conf-broadcast:
  777. Broadcast Commands
  778. ------------------
  779. .. setting:: CELERY_BROADCAST_QUEUE
  780. CELERY_BROADCAST_QUEUE
  781. ~~~~~~~~~~~~~~~~~~~~~~
  782. Name prefix for the queue used when listening for broadcast messages.
  783. The workers host name will be appended to the prefix to create the final
  784. queue name.
  785. Default is `"celeryctl"`.
  786. .. setting:: CELERY_BROADCAST_EXCHANGE
  787. CELERY_BROADCAST_EXCHANGE
  788. ~~~~~~~~~~~~~~~~~~~~~~~~~
  789. Name of the exchange used for broadcast messages.
  790. Default is `"celeryctl"`.
  791. .. setting:: CELERY_BROADCAST_EXCHANGE_TYPE
  792. CELERY_BROADCAST_EXCHANGE_TYPE
  793. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  794. Exchange type used for broadcast messages. Default is `"fanout"`.
  795. .. _conf-logging:
  796. Logging
  797. -------
  798. .. setting:: CELERYD_HIJACK_ROOT_LOGGER
  799. CELERYD_HIJACK_ROOT_LOGGER
  800. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  801. .. versionadded:: 2.2
  802. By default any previously configured logging options will be reset,
  803. because the Celery programs "hijacks" the root logger.
  804. If you want to customize your own logging then you can disable
  805. this behavior.
  806. .. note::
  807. Logging can also be customized by connecting to the
  808. :signal:`celery.signals.setup_logging` signal.
  809. .. setting:: CELERYD_LOG_COLOR
  810. CELERYD_LOG_COLOR
  811. ~~~~~~~~~~~~~~~~~
  812. Enables/disables colors in logging output by the Celery apps.
  813. By default colors are enabled if
  814. 1) the app is logging to a real terminal, and not a file.
  815. 2) the app is not running on Windows.
  816. .. setting:: CELERYD_LOG_FORMAT
  817. CELERYD_LOG_FORMAT
  818. ~~~~~~~~~~~~~~~~~~
  819. The format to use for log messages.
  820. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  821. See the Python :mod:`logging` module for more information about log
  822. formats.
  823. .. setting:: CELERYD_TASK_LOG_FORMAT
  824. CELERYD_TASK_LOG_FORMAT
  825. ~~~~~~~~~~~~~~~~~~~~~~~
  826. The format to use for log messages logged in tasks. Can be overridden using
  827. the :option:`--loglevel` option to :mod:`~celery.bin.celeryd`.
  828. Default is::
  829. [%(asctime)s: %(levelname)s/%(processName)s]
  830. [%(task_name)s(%(task_id)s)] %(message)s
  831. See the Python :mod:`logging` module for more information about log
  832. formats.
  833. .. setting:: CELERY_REDIRECT_STDOUTS
  834. CELERY_REDIRECT_STDOUTS
  835. ~~~~~~~~~~~~~~~~~~~~~~~
  836. If enabled `stdout` and `stderr` will be redirected
  837. to the current logger.
  838. Enabled by default.
  839. Used by :program:`celeryd` and :program:`celerybeat`.
  840. .. setting:: CELERY_REDIRECT_STDOUTS_LEVEL
  841. CELERY_REDIRECT_STDOUTS_LEVEL
  842. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  843. The log level output to `stdout` and `stderr` is logged as.
  844. Can be one of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  845. :const:`ERROR` or :const:`CRITICAL`.
  846. Default is :const:`WARNING`.
  847. .. _conf-security:
  848. Security
  849. --------
  850. .. setting:: CELERY_SECURITY_KEY
  851. CELERY_SECURITY_KEY
  852. ~~~~~~~~~~~~~~~~~~~
  853. .. versionadded:: 2.5
  854. The relative or absolute path to a file containing the private key
  855. used to sign messages when :ref:`message-signing` is used.
  856. .. setting:: CELERY_SECURITY_CERTIFICATE
  857. CELERY_SECURITY_CERTIFICATE
  858. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  859. .. versionadded:: 2.5
  860. The relative or absolute path to an X.509 certificate file
  861. used to sign messages when :ref:`message-signing` is used.
  862. .. setting:: CELERY_SECURITY_CERT_STORE
  863. CELERY_SECURITY_CERT_STORE
  864. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  865. .. versionadded:: 2.5
  866. The directory containing X.509 certificates used for
  867. :ref:`message-signing`. Can be a glob with wildcards,
  868. (for example :file:`/etc/certs/*.pem`).
  869. .. _conf-custom-components:
  870. Custom Component Classes (advanced)
  871. -----------------------------------
  872. .. setting:: CELERYD_BOOT_STEPS
  873. CELERYD_BOOT_STEPS
  874. ~~~~~~~~~~~~~~~~~~
  875. This setting enables you to add additional components to the worker process.
  876. It should be a list of module names with :class:`celery.abstract.Component`
  877. classes, that augments functionality in the worker.
  878. .. setting:: CELERYD_POOL
  879. CELERYD_POOL
  880. ~~~~~~~~~~~~
  881. Name of the pool class used by the worker.
  882. You can use a custom pool class name, or select one of
  883. the built-in aliases: ``processes``, ``eventlet``, ``gevent``.
  884. Default is ``processes``.
  885. .. setting:: CELERYD_AUTOSCALER
  886. CELERYD_AUTOSCALER
  887. ~~~~~~~~~~~~~~~~~~
  888. .. versionadded:: 2.2
  889. Name of the autoscaler class to use.
  890. Default is ``"celery.worker.autoscale.Autoscaler"``.
  891. .. setting:: CELERYD_AUTORELOADER
  892. CELERYD_AUTORELOADER
  893. ~~~~~~~~~~~~~~~~~~~~
  894. Name of the autoreloader class used by the worker to reload
  895. Python modules and files that have changed.
  896. Default is: ``"celery.worker.autoreload.Autoreloader"``.
  897. .. setting:: CELERYD_CONSUMER
  898. CELERYD_CONSUMER
  899. ~~~~~~~~~~~~~~~~
  900. Name of the consumer class used by the worker.
  901. Default is :class:`celery.worker.consumer.Consumer`
  902. .. setting:: CELERYD_MEDIATOR
  903. CELERYD_MEDIATOR
  904. ~~~~~~~~~~~~~~~~
  905. Name of the mediator class used by the worker.
  906. Default is :class:`celery.worker.controllers.Mediator`.
  907. .. setting:: CELERYD_TIMER
  908. CELERYD_TIMER
  909. ~~~~~~~~~~~~~~~~~~~~~
  910. Name of the ETA scheduler class used by the worker.
  911. Default is :class:`celery.utils.timer2.Timer`, or one overrided
  912. by the pool implementation.
  913. .. _conf-celerybeat:
  914. Periodic Task Server: celerybeat
  915. --------------------------------
  916. .. setting:: CELERYBEAT_SCHEDULE
  917. CELERYBEAT_SCHEDULE
  918. ~~~~~~~~~~~~~~~~~~~
  919. The periodic task schedule used by :mod:`~celery.bin.celerybeat`.
  920. See :ref:`beat-entries`.
  921. .. setting:: CELERYBEAT_SCHEDULER
  922. CELERYBEAT_SCHEDULER
  923. ~~~~~~~~~~~~~~~~~~~~
  924. The default scheduler class. Default is
  925. `"celery.beat.PersistentScheduler"`.
  926. Can also be set via the :option:`-S` argument to
  927. :mod:`~celery.bin.celerybeat`.
  928. .. setting:: CELERYBEAT_SCHEDULE_FILENAME
  929. CELERYBEAT_SCHEDULE_FILENAME
  930. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  931. Name of the file used by `PersistentScheduler` to store the last run times
  932. of periodic tasks. Can be a relative or absolute path, but be aware that the
  933. suffix `.db` may be appended to the file name (depending on Python version).
  934. Can also be set via the :option:`--schedule` argument to
  935. :mod:`~celery.bin.celerybeat`.
  936. .. setting:: CELERYBEAT_MAX_LOOP_INTERVAL
  937. CELERYBEAT_MAX_LOOP_INTERVAL
  938. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  939. The maximum number of seconds :mod:`~celery.bin.celerybeat` can sleep
  940. between checking the schedule.
  941. The default for this value is scheduler specific.
  942. For the default celerybeat scheduler the value is 300 (5 minutes),
  943. but for e.g. the django-celery database scheduler it is 5 seconds
  944. because the schedule may be changed externally, and so it must take
  945. changes to the schedule into account.
  946. Also when running celerybeat embedded (:option:`-B`) on Jython as a thread
  947. the max interval is overridden and set to 1 so that it's possible
  948. to shut down in a timely manner.
  949. .. _conf-celerymon:
  950. Monitor Server: celerymon
  951. -------------------------
  952. .. setting:: CELERYMON_LOG_FORMAT
  953. CELERYMON_LOG_FORMAT
  954. ~~~~~~~~~~~~~~~~~~~~
  955. The format to use for log messages.
  956. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  957. See the Python :mod:`logging` module for more information about log
  958. formats.
  959. .. _conf-deprecated:
  960. Deprecated Settings
  961. -------------------
  962. These settings have been deprecated and should no longer used,
  963. as they will be removed in future versions.
  964. .. setting:: CELERY_AMQP_TASK_RESULT_EXPIRES
  965. CELERY_AMQP_TASK_RESULT_EXPIRES
  966. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  967. .. deprecated:: 2.5
  968. The time in seconds of which the task result queues should expire.
  969. This setting is deprecated, and will be removed in version 3.0.
  970. Please use :setting:`CELERY_TASK_RESULT_EXPIRES` instead.
  971. .. note::
  972. AMQP result expiration requires RabbitMQ versions 2.1.0 or higher.
  973. .. setting:: CELERY_TASK_ERROR_WHITELIST
  974. CELERY_TASK_ERROR_WHITELIST
  975. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  976. .. deprecated:: 2.5
  977. A white list of exceptions to send error emails for.
  978. This option is pending deprecation and is scheduled for removal
  979. in version 3.0.
  980. .. setting:: CELERYD_LOG_FILE
  981. CELERYD_LOG_FILE
  982. ~~~~~~~~~~~~~~~~
  983. .. deprecated:: 2.4
  984. This option is deprecated and is scheduled for removal in version 3.0.
  985. Please use the :option:`--logfile` argument instead.
  986. The default file name the worker daemon logs messages to. Can be overridden
  987. using the :option:`--logfile` option to :mod:`~celery.bin.celeryd`.
  988. The default is :const:`None` (`stderr`)
  989. .. setting:: CELERYD_LOG_LEVEL
  990. CELERYD_LOG_LEVEL
  991. ~~~~~~~~~~~~~~~~~
  992. .. deprecated:: 2.4
  993. This option is deprecated and is scheduled for removal in version 3.0.
  994. Please use the :option:`--loglevel` argument instead.
  995. Worker log level, can be one of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  996. :const:`ERROR` or :const:`CRITICAL`.
  997. Can also be set via the :option:`--loglevel` argument to
  998. :mod:`~celery.bin.celeryd`.
  999. See the :mod:`logging` module for more information.
  1000. .. setting:: CELERYBEAT_LOG_FILE
  1001. CELERYBEAT_LOG_FILE
  1002. ~~~~~~~~~~~~~~~~~~~
  1003. .. deprecated:: 2.4
  1004. This option is deprecated and is scheduled for removal in version 3.0.
  1005. Please use the :option:`--logfile` argument instead.
  1006. The default file name to log messages to. Can be overridden using
  1007. the `--logfile` option to :mod:`~celery.bin.celerybeat`.
  1008. The default is :const:`None` (`stderr`).
  1009. .. setting:: CELERYBEAT_LOG_LEVEL
  1010. CELERYBEAT_LOG_LEVEL
  1011. ~~~~~~~~~~~~~~~~~~~~
  1012. .. deprecated:: 2.4
  1013. This option is deprecated and is scheduled for removal in version 3.0.
  1014. Please use the :option:`--loglevel` argument instead.
  1015. Logging level. Can be any of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1016. :const:`ERROR`, or :const:`CRITICAL`.
  1017. Can also be set via the :option:`--loglevel` argument to
  1018. :mod:`~celery.bin.celerybeat`.
  1019. See the :mod:`logging` module for more information.
  1020. .. setting:: CELERYMON_LOG_FILE
  1021. CELERYMON_LOG_FILE
  1022. ~~~~~~~~~~~~~~~~~~
  1023. .. deprecated:: 2.4
  1024. This option is deprecated and is scheduled for removal in version 3.0.
  1025. Please use the :option:`--logfile` argument instead.
  1026. The default file name to log messages to. Can be overridden using
  1027. the :option:`--logfile` argument to `celerymon`.
  1028. The default is :const:`None` (`stderr`)
  1029. .. setting:: CELERYMON_LOG_LEVEL
  1030. CELERYMON_LOG_LEVEL
  1031. ~~~~~~~~~~~~~~~~~~~
  1032. .. deprecated:: 2.4
  1033. This option is deprecated and is scheduled for removal in version 3.0.
  1034. Please use the :option:`--loglevel` argument instead.
  1035. Logging level. Can be any of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1036. :const:`ERROR`, or :const:`CRITICAL`.
  1037. See the :mod:`logging` module for more information.