configuration.rst 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211
  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 = 'db+sqlite:///results.db'
  23. CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
  24. Configuration Directives
  25. ========================
  26. .. _conf-datetime:
  27. Time and date settings
  28. ----------------------
  29. .. setting:: CELERY_ENABLE_UTC
  30. CELERY_ENABLE_UTC
  31. ~~~~~~~~~~~~~~~~~
  32. .. versionadded:: 2.5
  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. Enabled by default since 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 `pytz`_
  44. library.
  45. If not set the UTC timezone is used. For backwards compatibility
  46. there is also a :setting:`CELERY_ENABLE_UTC` setting, and this is set
  47. to false the system local timezone is used instead.
  48. .. _`pytz`: http://pypi.python.org/pypi/pytz/
  49. .. _conf-tasks:
  50. Task settings
  51. -------------
  52. .. setting:: CELERY_ANNOTATIONS
  53. CELERY_ANNOTATIONS
  54. ~~~~~~~~~~~~~~~~~~
  55. This setting can be used to rewrite any task attribute from the
  56. configuration. The setting can be a dict, or a list of annotation
  57. objects that filter for tasks and return a map of attributes
  58. to change.
  59. This will change the ``rate_limit`` attribute for the ``tasks.add``
  60. task:
  61. .. code-block:: python
  62. CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
  63. or change the same for all tasks:
  64. .. code-block:: python
  65. CELERY_ANNOTATIONS = {'*': {'rate_limit': '10/s'}}
  66. You can change methods too, for example the ``on_failure`` handler:
  67. .. code-block:: python
  68. def my_on_failure(self, exc, task_id, args, kwargs, einfo):
  69. print('Oh no! Task failed: {0!r}'.format(exc))
  70. CELERY_ANNOTATIONS = {'*': {'on_failure': my_on_failure}}
  71. If you need more flexibility then you can use objects
  72. instead of a dict to choose which tasks to annotate:
  73. .. code-block:: python
  74. class MyAnnotate(object):
  75. def annotate(self, task):
  76. if task.name.startswith('tasks.'):
  77. return {'rate_limit': '10/s'}
  78. CELERY_ANNOTATIONS = (MyAnnotate(), {…})
  79. .. _conf-concurrency:
  80. Concurrency settings
  81. --------------------
  82. .. setting:: CELERYD_CONCURRENCY
  83. CELERYD_CONCURRENCY
  84. ~~~~~~~~~~~~~~~~~~~
  85. The number of concurrent worker processes/threads/green threads executing
  86. tasks.
  87. If you're doing mostly I/O you can have more processes,
  88. but if mostly CPU-bound, try to keep it close to the
  89. number of CPUs on your machine. If not set, the number of CPUs/cores
  90. on the host will be used.
  91. Defaults to the number of available CPUs.
  92. .. setting:: CELERYD_PREFETCH_MULTIPLIER
  93. CELERYD_PREFETCH_MULTIPLIER
  94. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. How many messages to prefetch at a time multiplied by the number of
  96. concurrent processes. The default is 4 (four messages for each
  97. process). The default setting is usually a good choice, however -- if you
  98. have very long running tasks waiting in the queue and you have to start the
  99. workers, note that the first worker to start will receive four times the
  100. number of messages initially. Thus the tasks may not be fairly distributed
  101. to the workers.
  102. To disable prefetching, set CELERYD_PREFETCH_MULTIPLIER to 1. Setting
  103. CELERYD_PREFETCH_MULTIPLIER to 0 will allow the worker to keep consuming
  104. as many messages as it wants.
  105. For more on prefetching, read :ref:`optimizing-prefetch-limit`
  106. .. note::
  107. Tasks with ETA/countdown are not affected by prefetch limits.
  108. .. _conf-result-backend:
  109. Task result backend settings
  110. ----------------------------
  111. .. setting:: CELERY_RESULT_BACKEND
  112. CELERY_RESULT_BACKEND
  113. ~~~~~~~~~~~~~~~~~~~~~
  114. :Deprecated aliases: ``CELERY_BACKEND``
  115. The backend used to store task results (tombstones).
  116. Disabled by default.
  117. Can be one of the following:
  118. * rpc
  119. Send results back as AMQP messages
  120. See :ref:`conf-rpc-result-backend`.
  121. * database
  122. Use a relational database supported by `SQLAlchemy`_.
  123. See :ref:`conf-database-result-backend`.
  124. * redis
  125. Use `Redis`_ to store the results.
  126. See :ref:`conf-redis-result-backend`.
  127. * cache
  128. Use `memcached`_ to store the results.
  129. See :ref:`conf-cache-result-backend`.
  130. * mongodb
  131. Use `MongoDB`_ to store the results.
  132. See :ref:`conf-mongodb-result-backend`.
  133. * cassandra
  134. Use `Cassandra`_ to store the results.
  135. See :ref:`conf-cassandra-result-backend`.
  136. * new_cassandra
  137. Use `new_cassandra`_ to store the results, using newer database driver than _cassandra_.
  138. See :ref:`conf-new_cassandra-result-backend`.
  139. * ironcache
  140. Use `IronCache`_ to store the results.
  141. See :ref:`conf-ironcache-result-backend`.
  142. * couchbase
  143. Use `Couchbase`_ to store the results.
  144. See :ref:`conf-couchbase-result-backend`.
  145. * couchdb
  146. Use `CouchDB`_ to store the results.
  147. See :ref:`conf-couchdb-result-backend`.
  148. * amqp
  149. Older AMQP backend (badly) emulating a database-based backend.
  150. See :ref:`conf-amqp-result-backend`.
  151. .. warning:
  152. While the AMQP result backend is very efficient, you must make sure
  153. you only receive the same result once. See :doc:`userguide/calling`).
  154. .. _`SQLAlchemy`: http://sqlalchemy.org
  155. .. _`memcached`: http://memcached.org
  156. .. _`MongoDB`: http://mongodb.org
  157. .. _`Redis`: http://redis.io
  158. .. _`Cassandra`: http://cassandra.apache.org/
  159. .. _`IronCache`: http://www.iron.io/cache
  160. .. _`CouchDB`: http://www.couchdb.com/
  161. .. _`Couchbase`: http://www.couchbase.com/
  162. .. setting:: CELERY_RESULT_SERIALIZER
  163. CELERY_RESULT_SERIALIZER
  164. ~~~~~~~~~~~~~~~~~~~~~~~~
  165. Result serialization format. Default is ``pickle``. See
  166. :ref:`calling-serializers` for information about supported
  167. serialization formats.
  168. .. _conf-database-result-backend:
  169. Database backend settings
  170. -------------------------
  171. Database URL Examples
  172. ~~~~~~~~~~~~~~~~~~~~~
  173. To use the database backend you have to configure the
  174. :setting:`CELERY_RESULT_BACKEND` setting with a connection URL and the ``db+``
  175. prefix:
  176. .. code-block:: python
  177. CELERY_RESULT_BACKEND = 'db+scheme://user:password@host:port/dbname'
  178. Examples::
  179. # sqlite (filename)
  180. CELERY_RESULT_BACKEND = 'db+sqlite:///results.sqlite'
  181. # mysql
  182. CELERY_RESULT_BACKEND = 'db+mysql://scott:tiger@localhost/foo'
  183. # postgresql
  184. CELERY_RESULT_BACKEND = 'db+postgresql://scott:tiger@localhost/mydatabase'
  185. # oracle
  186. CELERY_RESULT_BACKEND = 'db+oracle://scott:tiger@127.0.0.1:1521/sidname'
  187. .. code-block:: python
  188. Please see `Supported Databases`_ for a table of supported databases,
  189. and `Connection String`_ for more information about connection
  190. strings (which is the part of the URI that comes after the ``db+`` prefix).
  191. .. _`Supported Databases`:
  192. http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
  193. .. _`Connection String`:
  194. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  195. .. setting:: CELERY_RESULT_DBURI
  196. CELERY_RESULT_DBURI
  197. ~~~~~~~~~~~~~~~~~~~
  198. This setting is no longer used as it's now possible to specify
  199. the database URL directly in the :setting:`CELERY_RESULT_BACKEND` setting.
  200. .. setting:: CELERY_RESULT_ENGINE_OPTIONS
  201. CELERY_RESULT_ENGINE_OPTIONS
  202. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203. To specify additional SQLAlchemy database engine options you can use
  204. the :setting:`CELERY_RESULT_ENGINE_OPTIONS` setting::
  205. # echo enables verbose logging from SQLAlchemy.
  206. CELERY_RESULT_ENGINE_OPTIONS = {'echo': True}
  207. .. setting:: CELERY_RESULT_DB_SHORT_LIVED_SESSIONS
  208. Short lived sessions
  209. ~~~~~~~~~~~~~~~~~~~~
  210. CELERY_RESULT_DB_SHORT_LIVED_SESSIONS = True
  211. Short lived sessions are disabled by default. If enabled they can drastically reduce
  212. performance, especially on systems processing lots of tasks. This option is useful
  213. on low-traffic workers that experience errors as a result of cached database connections
  214. going stale through inactivity. For example, intermittent errors like
  215. `(OperationalError) (2006, 'MySQL server has gone away')` can be fixed by enabling
  216. short lived sessions. This option only affects the database backend.
  217. Specifying Table Names
  218. ~~~~~~~~~~~~~~~~~~~~~~
  219. .. setting:: CELERY_RESULT_DB_TABLENAMES
  220. When SQLAlchemy is configured as the result backend, Celery automatically
  221. creates two tables to store result metadata for tasks. This setting allows
  222. you to customize the table names:
  223. .. code-block:: python
  224. # use custom table names for the database result backend.
  225. CELERY_RESULT_DB_TABLENAMES = {
  226. 'task': 'myapp_taskmeta',
  227. 'group': 'myapp_groupmeta',
  228. }
  229. .. _conf-rpc-result-backend:
  230. RPC backend settings
  231. --------------------
  232. .. _conf-amqp-result-backend:
  233. CELERY_RESULT_PERSISTENT
  234. ~~~~~~~~~~~~~~~~~~~~~~~~
  235. If set to :const:`True`, result messages will be persistent. This means the
  236. messages will not be lost after a broker restart. The default is for the
  237. results to be transient.
  238. Example configuration
  239. ~~~~~~~~~~~~~~~~~~~~~
  240. .. code-block:: python
  241. CELERY_RESULT_BACKEND = 'rpc://'
  242. CELERY_RESULT_PERSISTENT = False
  243. .. _conf-cache-result-backend:
  244. Cache backend settings
  245. ----------------------
  246. .. note::
  247. The cache backend supports the `pylibmc`_ and `python-memcached`
  248. libraries. The latter is used only if `pylibmc`_ is not installed.
  249. Using a single memcached server:
  250. .. code-block:: python
  251. CELERY_RESULT_BACKEND = 'cache+memcached://127.0.0.1:11211/'
  252. Using multiple memcached servers:
  253. .. code-block:: python
  254. CELERY_RESULT_BACKEND = """
  255. cache+memcached://172.19.26.240:11211;172.19.26.242:11211/
  256. """.strip()
  257. .. setting:: CELERY_CACHE_BACKEND_OPTIONS
  258. The "memory" backend stores the cache in memory only:
  259. .. code-block:: python
  260. CELERY_RESULT_BACKEND = 'cache'
  261. CELERY_CACHE_BACKEND = 'memory'
  262. CELERY_CACHE_BACKEND_OPTIONS
  263. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  264. You can set pylibmc options using the :setting:`CELERY_CACHE_BACKEND_OPTIONS`
  265. setting:
  266. .. code-block:: python
  267. CELERY_CACHE_BACKEND_OPTIONS = {'binary': True,
  268. 'behaviors': {'tcp_nodelay': True}}
  269. .. _`pylibmc`: http://sendapatch.se/projects/pylibmc/
  270. .. setting:: CELERY_CACHE_BACKEND
  271. CELERY_CACHE_BACKEND
  272. ~~~~~~~~~~~~~~~~~~~~
  273. This setting is no longer used as it's now possible to specify
  274. the cache backend directly in the :setting:`CELERY_RESULT_BACKEND` setting.
  275. .. _conf-redis-result-backend:
  276. Redis backend settings
  277. ----------------------
  278. Configuring the backend URL
  279. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  280. .. note::
  281. The Redis backend requires the :mod:`redis` library:
  282. http://pypi.python.org/pypi/redis/
  283. To install the redis package use `pip` or `easy_install`:
  284. .. code-block:: console
  285. $ pip install redis
  286. This backend requires the :setting:`CELERY_RESULT_BACKEND`
  287. setting to be set to a Redis URL::
  288. CELERY_RESULT_BACKEND = 'redis://:password@host:port/db'
  289. For example::
  290. CELERY_RESULT_BACKEND = 'redis://localhost/0'
  291. which is the same as::
  292. CELERY_RESULT_BACKEND = 'redis://'
  293. The fields of the URL are defined as follows:
  294. - *host*
  295. Host name or IP address of the Redis server. e.g. `localhost`.
  296. - *port*
  297. Port to the Redis server. Default is 6379.
  298. - *db*
  299. Database number to use. Default is 0.
  300. The db can include an optional leading slash.
  301. - *password*
  302. Password used to connect to the database.
  303. .. setting:: CELERY_REDIS_MAX_CONNECTIONS
  304. CELERY_REDIS_MAX_CONNECTIONS
  305. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  306. Maximum number of connections available in the Redis connection
  307. pool used for sending and retrieving results.
  308. .. _conf-mongodb-result-backend:
  309. MongoDB backend settings
  310. ------------------------
  311. .. note::
  312. The MongoDB backend requires the :mod:`pymongo` library:
  313. http://github.com/mongodb/mongo-python-driver/tree/master
  314. .. setting:: CELERY_MONGODB_BACKEND_SETTINGS
  315. CELERY_MONGODB_BACKEND_SETTINGS
  316. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  317. This is a dict supporting the following keys:
  318. * database
  319. The database name to connect to. Defaults to ``celery``.
  320. * taskmeta_collection
  321. The collection name to store task meta data.
  322. Defaults to ``celery_taskmeta``.
  323. * max_pool_size
  324. Passed as max_pool_size to PyMongo's Connection or MongoClient
  325. constructor. It is the maximum number of TCP connections to keep
  326. open to MongoDB at a given time. If there are more open connections
  327. than max_pool_size, sockets will be closed when they are released.
  328. Defaults to 10.
  329. * options
  330. Additional keyword arguments to pass to the mongodb connection
  331. constructor. See the :mod:`pymongo` docs to see a list of arguments
  332. supported.
  333. .. _example-mongodb-result-config:
  334. Example configuration
  335. ~~~~~~~~~~~~~~~~~~~~~
  336. .. code-block:: python
  337. CELERY_RESULT_BACKEND = 'mongodb://192.168.1.100:30000/'
  338. CELERY_MONGODB_BACKEND_SETTINGS = {
  339. 'database': 'mydb',
  340. 'taskmeta_collection': 'my_taskmeta_collection',
  341. }
  342. .. _conf-new_cassandra-result-backend:
  343. new_cassandra backend settings
  344. --------------------------
  345. .. note::
  346. This Cassandra backend driver requires :mod:`cassandra-driver`.
  347. https://pypi.python.org/pypi/cassandra-driver
  348. To install, use `pip` or `easy_install`:
  349. .. code-block:: bash
  350. $ pip install cassandra-driver
  351. This backend requires the following configuration directives to be set.
  352. .. setting:: CASSANDRA_SERVERS
  353. CASSANDRA_SERVERS
  354. ~~~~~~~~~~~~~~~~~
  355. List of ``host`` Cassandra servers. e.g.::
  356. CASSANDRA_SERVERS = ['localhost']
  357. .. setting:: CASSANDRA_PORT
  358. CASSANDRA_PORT
  359. ~~~~~~~~~~~~~~
  360. Port to contact the Cassandra servers on. Default is 9042.
  361. .. setting:: CASSANDRA_KEYSPACE
  362. CASSANDRA_KEYSPACE
  363. ~~~~~~~~~~~~~~~~~~
  364. The keyspace in which to store the results. e.g.::
  365. CASSANDRA_KEYSPACE = 'tasks_keyspace'
  366. .. setting:: CASSANDRA_COLUMN_FAMILY
  367. CASSANDRA_TABLE
  368. ~~~~~~~~~~~~~~~~~~~~~~~
  369. The table (column family) in which to store the results. e.g.::
  370. CASSANDRA_TABLE = 'tasks'
  371. .. setting:: CASSANDRA_READ_CONSISTENCY
  372. CASSANDRA_READ_CONSISTENCY
  373. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  374. The read consistency used. Values can be ``ONE``, ``TWO``, ``THREE``, ``QUORUM``, ``ALL``,
  375. ``LOCAL_QUORUM``, ``EACH_QUORUM``, ``LOCAL_ONE``.
  376. .. setting:: CASSANDRA_WRITE_CONSISTENCY
  377. CASSANDRA_WRITE_CONSISTENCY
  378. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  379. The write consistency used. Values can be ``ONE``, ``TWO``, ``THREE``, ``QUORUM``, ``ALL``,
  380. ``LOCAL_QUORUM``, ``EACH_QUORUM``, ``LOCAL_ONE``.
  381. .. setting:: CASSANDRA_ENTRY_TTL
  382. CASSANDRA_ENTRY_TTL
  383. ~~~~~~~~~~~~~~~~~~~
  384. Time-to-live for status entries. They will expire and be removed after that many seconds
  385. after adding. Default (None) means they will never expire.
  386. Example configuration
  387. ~~~~~~~~~~~~~~~~~~~~~
  388. .. code-block:: python
  389. CASSANDRA_SERVERS = ['localhost']
  390. CASSANDRA_KEYSPACE = 'celery'
  391. CASSANDRA_COLUMN_FAMILY = 'task_results'
  392. CASSANDRA_READ_CONSISTENCY = 'ONE'
  393. CASSANDRA_WRITE_CONSISTENCY = 'ONE'
  394. CASSANDRA_ENTRY_TTL = 86400
  395. Cassandra backend settings
  396. --------------------------
  397. .. note::
  398. The Cassandra backend requires the :mod:`pycassa` library:
  399. http://pypi.python.org/pypi/pycassa/
  400. To install the pycassa package use `pip` or `easy_install`:
  401. .. code-block:: console
  402. $ pip install pycassa
  403. This backend requires the following configuration directives to be set.
  404. .. setting:: CASSANDRA_SERVERS
  405. CASSANDRA_SERVERS
  406. ~~~~~~~~~~~~~~~~~
  407. List of ``host:port`` Cassandra servers. e.g.::
  408. CASSANDRA_SERVERS = ['localhost:9160']
  409. .. setting:: CASSANDRA_KEYSPACE
  410. CASSANDRA_KEYSPACE
  411. ~~~~~~~~~~~~~~~~~~
  412. The keyspace in which to store the results. e.g.::
  413. CASSANDRA_KEYSPACE = 'tasks_keyspace'
  414. .. setting:: CASSANDRA_COLUMN_FAMILY
  415. CASSANDRA_COLUMN_FAMILY
  416. ~~~~~~~~~~~~~~~~~~~~~~~
  417. The column family in which to store the results. e.g.::
  418. CASSANDRA_COLUMN_FAMILY = 'tasks'
  419. .. setting:: CASSANDRA_READ_CONSISTENCY
  420. CASSANDRA_READ_CONSISTENCY
  421. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  422. The read consistency used. Values can be ``ONE``, ``QUORUM`` or ``ALL``.
  423. .. setting:: CASSANDRA_WRITE_CONSISTENCY
  424. CASSANDRA_WRITE_CONSISTENCY
  425. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  426. The write consistency used. Values can be ``ONE``, ``QUORUM`` or ``ALL``.
  427. .. setting:: CASSANDRA_DETAILED_MODE
  428. CASSANDRA_DETAILED_MODE
  429. ~~~~~~~~~~~~~~~~~~~~~~~
  430. Enable or disable detailed mode. Default is :const:`False`.
  431. This mode allows to use the power of Cassandra wide columns to
  432. store all states for a task as a wide column, instead of only the last one.
  433. To use this mode, you need to configure your ColumnFamily to
  434. use the ``TimeUUID`` type as a comparator::
  435. create column family task_results with comparator = TimeUUIDType;
  436. CASSANDRA_OPTIONS
  437. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  438. Options to be passed to the `pycassa connection pool`_ (optional).
  439. .. _`pycassa connection pool`: http://pycassa.github.com/pycassa/api/pycassa/pool.html
  440. Example configuration
  441. ~~~~~~~~~~~~~~~~~~~~~
  442. .. code-block:: python
  443. CASSANDRA_SERVERS = ['localhost:9160']
  444. CASSANDRA_KEYSPACE = 'celery'
  445. CASSANDRA_COLUMN_FAMILY = 'task_results'
  446. CASSANDRA_READ_CONSISTENCY = 'ONE'
  447. CASSANDRA_WRITE_CONSISTENCY = 'ONE'
  448. CASSANDRA_DETAILED_MODE = True
  449. CASSANDRA_OPTIONS = {
  450. 'timeout': 300,
  451. 'max_retries': 10
  452. }
  453. .. _conf-riak-result-backend:
  454. Riak backend settings
  455. ---------------------
  456. .. note::
  457. The Riak backend requires the :mod:`riak` library:
  458. http://pypi.python.org/pypi/riak/
  459. To install the riak package use `pip` or `easy_install`:
  460. .. code-block:: console
  461. $ pip install riak
  462. This backend requires the :setting:`CELERY_RESULT_BACKEND`
  463. setting to be set to a Riak URL::
  464. CELERY_RESULT_BACKEND = "riak://host:port/bucket"
  465. For example::
  466. CELERY_RESULT_BACKEND = "riak://localhost/celery
  467. which is the same as::
  468. CELERY_RESULT_BACKEND = "riak://"
  469. The fields of the URL are defined as follows:
  470. - *host*
  471. Host name or IP address of the Riak server. e.g. `"localhost"`.
  472. - *port*
  473. Port to the Riak server using the protobuf protocol. Default is 8087.
  474. - *bucket*
  475. Bucket name to use. Default is `celery`.
  476. The bucket needs to be a string with ascii characters only.
  477. Altenatively, this backend can be configured with the following configuration directives.
  478. .. setting:: CELERY_RIAK_BACKEND_SETTINGS
  479. CELERY_RIAK_BACKEND_SETTINGS
  480. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  481. This is a dict supporting the following keys:
  482. * host
  483. The host name of the Riak server. Defaults to "localhost".
  484. * port
  485. The port the Riak server is listening to. Defaults to 8087.
  486. * bucket
  487. The bucket name to connect to. Defaults to "celery".
  488. * protocol
  489. The protocol to use to connect to the Riak server. This is not configurable
  490. via :setting:`CELERY_RESULT_BACKEND`
  491. .. _conf-ironcache-result-backend:
  492. IronCache backend settings
  493. --------------------------
  494. .. note::
  495. The IronCache backend requires the :mod:`iron_celery` library:
  496. http://pypi.python.org/pypi/iron_celery
  497. To install the iron_celery package use `pip` or `easy_install`:
  498. .. code-block:: console
  499. $ pip install iron_celery
  500. IronCache is configured via the URL provided in :setting:`CELERY_RESULT_BACKEND`, for example::
  501. CELERY_RESULT_BACKEND = 'ironcache://project_id:token@'
  502. Or to change the cache name::
  503. ironcache:://project_id:token@/awesomecache
  504. For more information, see: https://github.com/iron-io/iron_celery
  505. .. _conf-couchbase-result-backend:
  506. Couchbase backend settings
  507. --------------------------
  508. .. note::
  509. The Couchbase backend requires the :mod:`couchbase` library:
  510. https://pypi.python.org/pypi/couchbase
  511. To install the couchbase package use `pip` or `easy_install`:
  512. .. code-block:: console
  513. $ pip install couchbase
  514. This backend can be configured via the :setting:`CELERY_RESULT_BACKEND`
  515. set to a couchbase URL::
  516. CELERY_RESULT_BACKEND = 'couchbase://username:password@host:port/bucket'
  517. .. setting:: CELERY_COUCHBASE_BACKEND_SETTINGS
  518. CELERY_COUCHBASE_BACKEND_SETTINGS
  519. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  520. This is a dict supporting the following keys:
  521. * host
  522. Host name of the Couchbase server. Defaults to ``localhost``.
  523. * port
  524. The port the Couchbase server is listening to. Defaults to ``8091``.
  525. * bucket
  526. The default bucket the Couchbase server is writing to.
  527. Defaults to ``default``.
  528. * username
  529. User name to authenticate to the Couchbase server as (optional).
  530. * password
  531. Password to authenticate to the Couchbase server (optional).
  532. .. _conf-couchdb-result-backend:
  533. CouchDB backend settings
  534. ------------------------
  535. .. note::
  536. The CouchDB backend requires the :mod:`pycouchdb` library:
  537. https://pypi.python.org/pypi/pycouchdb
  538. To install the couchbase package use `pip` or `easy_install`:
  539. .. code-block:: console
  540. $ pip install pycouchdb
  541. This backend can be configured via the :setting:`CELERY_RESULT_BACKEND`
  542. set to a couchdb URL::
  543. CELERY_RESULT_BACKEND = 'couchdb://username:password@host:port/container'
  544. The URL is formed out of the following parts:
  545. * username
  546. User name to authenticate to the CouchDB server as (optional).
  547. * password
  548. Password to authenticate to the CouchDB server (optional).
  549. * host
  550. Host name of the CouchDB server. Defaults to ``localhost``.
  551. * port
  552. The port the CouchDB server is listening to. Defaults to ``8091``.
  553. * container
  554. The default container the CouchDB server is writing to.
  555. Defaults to ``default``.
  556. AMQP backend settings
  557. ---------------------
  558. .. admonition:: Do not use in production.
  559. This is the old AMQP result backend that creates one queue per task,
  560. if you want to send results back as message please consider using the
  561. RPC backend instead, or if you need the results to be persistent
  562. use a result backend designed for that purpose (e.g. Redis, or a database).
  563. .. note::
  564. The AMQP backend requires RabbitMQ 1.1.0 or higher to automatically
  565. expire results. If you are running an older version of RabbitMQ
  566. you should disable result expiration like this:
  567. CELERY_TASK_RESULT_EXPIRES = None
  568. .. setting:: CELERY_RESULT_EXCHANGE
  569. CELERY_RESULT_EXCHANGE
  570. ~~~~~~~~~~~~~~~~~~~~~~
  571. Name of the exchange to publish results in. Default is `celeryresults`.
  572. .. setting:: CELERY_RESULT_EXCHANGE_TYPE
  573. CELERY_RESULT_EXCHANGE_TYPE
  574. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  575. The exchange type of the result exchange. Default is to use a `direct`
  576. exchange.
  577. .. setting:: CELERY_RESULT_PERSISTENT
  578. CELERY_RESULT_PERSISTENT
  579. ~~~~~~~~~~~~~~~~~~~~~~~~
  580. If set to :const:`True`, result messages will be persistent. This means the
  581. messages will not be lost after a broker restart. The default is for the
  582. results to be transient.
  583. Example configuration
  584. ~~~~~~~~~~~~~~~~~~~~~
  585. .. code-block:: python
  586. CELERY_RESULT_BACKEND = 'amqp'
  587. CELERY_TASK_RESULT_EXPIRES = 18000 # 5 hours.
  588. .. _conf-messaging:
  589. Message Routing
  590. ---------------
  591. .. _conf-messaging-routing:
  592. .. setting:: CELERY_QUEUES
  593. CELERY_QUEUES
  594. ~~~~~~~~~~~~~
  595. Most users will not want to specify this setting and should rather use
  596. the :ref:`automatic routing facilities <routing-automatic>`.
  597. If you really want to configure advanced routing, this setting should
  598. be a list of :class:`kombu.Queue` objects the worker will consume from.
  599. Note that workers can be overriden this setting via the `-Q` option,
  600. or individual queues from this list (by name) can be excluded using
  601. the `-X` option.
  602. Also see :ref:`routing-basics` for more information.
  603. The default is a queue/exchange/binding key of ``celery``, with
  604. exchange type ``direct``.
  605. See also :setting:`CELERY_ROUTES`
  606. .. setting:: CELERY_ROUTES
  607. CELERY_ROUTES
  608. ~~~~~~~~~~~~~
  609. A list of routers, or a single router used to route tasks to queues.
  610. When deciding the final destination of a task the routers are consulted
  611. in order.
  612. A router can be specified as either:
  613. * A router class instances
  614. * A string which provides the path to a router class
  615. * A dict containing router specification. It will be converted to a :class:`celery.routes.MapRoute` instance.
  616. Examples:
  617. .. code-block:: python
  618. CELERY_ROUTES = {"celery.ping": "default",
  619. "mytasks.add": "cpu-bound",
  620. "video.encode": {
  621. "queue": "video",
  622. "exchange": "media"
  623. "routing_key": "media.video.encode"}}
  624. CELERY_ROUTES = ("myapp.tasks.Router", {"celery.ping": "default})
  625. Where ``myapp.tasks.Router`` could be:
  626. .. code-block:: python
  627. class Router(object):
  628. def route_for_task(self, task, args=None, kwargs=None):
  629. if task == "celery.ping":
  630. return "default"
  631. ``route_for_task`` may return a string or a dict. A string then means
  632. it's a queue name in :setting:`CELERY_QUEUES`, a dict means it's a custom route.
  633. When sending tasks, the routers are consulted in order. The first
  634. router that doesn't return ``None`` is the route to use. The message options
  635. is then merged with the found route settings, where the routers settings
  636. have priority.
  637. Example if :func:`~celery.execute.apply_async` has these arguments:
  638. .. code-block:: python
  639. Task.apply_async(immediate=False, exchange="video",
  640. routing_key="video.compress")
  641. and a router returns:
  642. .. code-block:: python
  643. {"immediate": True, "exchange": "urgent"}
  644. the final message options will be:
  645. .. code-block:: python
  646. immediate=True, exchange="urgent", routing_key="video.compress"
  647. (and any default message options defined in the
  648. :class:`~celery.task.base.Task` class)
  649. Values defined in :setting:`CELERY_ROUTES` have precedence over values defined in
  650. :setting:`CELERY_QUEUES` when merging the two.
  651. With the follow settings:
  652. .. code-block:: python
  653. CELERY_QUEUES = {"cpubound": {"exchange": "cpubound",
  654. "routing_key": "cpubound"}}
  655. CELERY_ROUTES = {"tasks.add": {"queue": "cpubound",
  656. "routing_key": "tasks.add",
  657. "serializer": "json"}}
  658. The final routing options for ``tasks.add`` will become:
  659. .. code-block:: javascript
  660. {"exchange": "cpubound",
  661. "routing_key": "tasks.add",
  662. "serializer": "json"}
  663. See :ref:`routers` for more examples.
  664. .. setting:: CELERY_QUEUE_HA_POLICY
  665. CELERY_QUEUE_HA_POLICY
  666. ~~~~~~~~~~~~~~~~~~~~~~
  667. :brokers: RabbitMQ
  668. This will set the default HA policy for a queue, and the value
  669. can either be a string (usually ``all``):
  670. .. code-block:: python
  671. CELERY_QUEUE_HA_POLICY = 'all'
  672. Using 'all' will replicate the queue to all current nodes,
  673. Or you can give it a list of nodes to replicate to:
  674. .. code-block:: python
  675. CELERY_QUEUE_HA_POLICY = ['rabbit@host1', 'rabbit@host2']
  676. Using a list will implicitly set ``x-ha-policy`` to 'nodes' and
  677. ``x-ha-policy-params`` to the given list of nodes.
  678. See http://www.rabbitmq.com/ha.html for more information.
  679. .. setting:: CELERY_WORKER_DIRECT
  680. CELERY_WORKER_DIRECT
  681. ~~~~~~~~~~~~~~~~~~~~
  682. This option enables so that every worker has a dedicated queue,
  683. so that tasks can be routed to specific workers.
  684. The queue name for each worker is automatically generated based on
  685. the worker hostname and a ``.dq`` suffix, using the ``C.dq`` exchange.
  686. For example the queue name for the worker with node name ``w1@example.com``
  687. becomes::
  688. w1@example.com.dq
  689. Then you can route the task to the task by specifying the hostname
  690. as the routing key and the ``C.dq`` exchange::
  691. CELERY_ROUTES = {
  692. 'tasks.add': {'exchange': 'C.dq', 'routing_key': 'w1@example.com'}
  693. }
  694. .. setting:: CELERY_CREATE_MISSING_QUEUES
  695. CELERY_CREATE_MISSING_QUEUES
  696. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  697. If enabled (default), any queues specified that are not defined in
  698. :setting:`CELERY_QUEUES` will be automatically created. See
  699. :ref:`routing-automatic`.
  700. .. setting:: CELERY_DEFAULT_QUEUE
  701. CELERY_DEFAULT_QUEUE
  702. ~~~~~~~~~~~~~~~~~~~~
  703. The name of the default queue used by `.apply_async` if the message has
  704. no route or no custom queue has been specified.
  705. This queue must be listed in :setting:`CELERY_QUEUES`.
  706. If :setting:`CELERY_QUEUES` is not specified then it is automatically
  707. created containing one queue entry, where this name is used as the name of
  708. that queue.
  709. The default is: `celery`.
  710. .. seealso::
  711. :ref:`routing-changing-default-queue`
  712. .. setting:: CELERY_DEFAULT_EXCHANGE
  713. CELERY_DEFAULT_EXCHANGE
  714. ~~~~~~~~~~~~~~~~~~~~~~~
  715. Name of the default exchange to use when no custom exchange is
  716. specified for a key in the :setting:`CELERY_QUEUES` setting.
  717. The default is: `celery`.
  718. .. setting:: CELERY_DEFAULT_EXCHANGE_TYPE
  719. CELERY_DEFAULT_EXCHANGE_TYPE
  720. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  721. Default exchange type used when no custom exchange type is specified
  722. for a key in the :setting:`CELERY_QUEUES` setting.
  723. The default is: `direct`.
  724. .. setting:: CELERY_DEFAULT_ROUTING_KEY
  725. CELERY_DEFAULT_ROUTING_KEY
  726. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  727. The default routing key used when no custom routing key
  728. is specified for a key in the :setting:`CELERY_QUEUES` setting.
  729. The default is: `celery`.
  730. .. setting:: CELERY_DEFAULT_DELIVERY_MODE
  731. CELERY_DEFAULT_DELIVERY_MODE
  732. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  733. Can be `transient` or `persistent`. The default is to send
  734. persistent messages.
  735. .. _conf-broker-settings:
  736. Broker Settings
  737. ---------------
  738. .. setting:: CELERY_ACCEPT_CONTENT
  739. CELERY_ACCEPT_CONTENT
  740. ~~~~~~~~~~~~~~~~~~~~~
  741. A whitelist of content-types/serializers to allow.
  742. If a message is received that is not in this list then
  743. the message will be discarded with an error.
  744. By default any content type is enabled (including pickle and yaml)
  745. so make sure untrusted parties do not have access to your broker.
  746. See :ref:`guide-security` for more.
  747. Example::
  748. # using serializer name
  749. CELERY_ACCEPT_CONTENT = ['json']
  750. # or the actual content-type (MIME)
  751. CELERY_ACCEPT_CONTENT = ['application/json']
  752. .. setting:: BROKER_FAILOVER_STRATEGY
  753. BROKER_FAILOVER_STRATEGY
  754. ~~~~~~~~~~~~~~~~~~~~~~~~
  755. Default failover strategy for the broker Connection object. If supplied,
  756. may map to a key in 'kombu.connection.failover_strategies', or be a reference
  757. to any method that yields a single item from a supplied list.
  758. Example::
  759. # Random failover strategy
  760. def random_failover_strategy(servers):
  761. it = list(it) # don't modify callers list
  762. shuffle = random.shuffle
  763. for _ in repeat(None):
  764. shuffle(it)
  765. yield it[0]
  766. BROKER_FAILOVER_STRATEGY=random_failover_strategy
  767. .. setting:: BROKER_TRANSPORT
  768. BROKER_TRANSPORT
  769. ~~~~~~~~~~~~~~~~
  770. :Aliases: ``BROKER_BACKEND``
  771. :Deprecated aliases: ``CARROT_BACKEND``
  772. .. setting:: BROKER_URL
  773. BROKER_URL
  774. ~~~~~~~~~~
  775. Default broker URL. This must be an URL in the form of::
  776. transport://userid:password@hostname:port/virtual_host
  777. Only the scheme part (``transport://``) is required, the rest
  778. is optional, and defaults to the specific transports default values.
  779. The transport part is the broker implementation to use, and the
  780. default is ``amqp``, which uses ``librabbitmq`` by default or falls back to
  781. ``pyamqp`` if that is not installed. Also there are many other choices including
  782. ``redis``, ``beanstalk``, ``sqlalchemy``, ``django``, ``mongodb``,
  783. ``couchdb``.
  784. It can also be a fully qualified path to your own transport implementation.
  785. See :ref:`kombu:connection-urls` in the Kombu documentation for more
  786. information.
  787. .. setting:: BROKER_HEARTBEAT
  788. BROKER_HEARTBEAT
  789. ~~~~~~~~~~~~~~~~
  790. :transports supported: ``pyamqp``
  791. It's not always possible to detect connection loss in a timely
  792. manner using TCP/IP alone, so AMQP defines something called heartbeats
  793. that's is used both by the client and the broker to detect if
  794. a connection was closed.
  795. Heartbeats are disabled by default.
  796. If the heartbeat value is 10 seconds, then
  797. the heartbeat will be monitored at the interval specified
  798. by the :setting:`BROKER_HEARTBEAT_CHECKRATE` setting, which by default is
  799. double the rate of the heartbeat value
  800. (so for the default 10 seconds, the heartbeat is checked every 5 seconds).
  801. .. setting:: BROKER_HEARTBEAT_CHECKRATE
  802. BROKER_HEARTBEAT_CHECKRATE
  803. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  804. :transports supported: ``pyamqp``
  805. At intervals the worker will monitor that the broker has not missed
  806. too many heartbeats. The rate at which this is checked is calculated
  807. by dividing the :setting:`BROKER_HEARTBEAT` value with this value,
  808. so if the heartbeat is 10.0 and the rate is the default 2.0, the check
  809. will be performed every 5 seconds (twice the heartbeat sending rate).
  810. .. setting:: BROKER_USE_SSL
  811. BROKER_USE_SSL
  812. ~~~~~~~~~~~~~~
  813. :transports supported: ``pyamqp``
  814. Toggles SSL usage on broker connection and SSL settings.
  815. If ``True`` the connection will use SSL with default SSL settings.
  816. If set to a dict, will configure SSL connection according to the specified
  817. policy. The format used is python `ssl.wrap_socket()
  818. options <https://docs.python.org/3/library/ssl.html#ssl.wrap_socket>`_.
  819. Default is ``False`` (no SSL).
  820. Note that SSL socket is generally served on a separate port by the broker.
  821. Example providing a client cert and validating the server cert against a custom
  822. certificate authority:
  823. .. code-block:: python
  824. import ssl
  825. BROKER_USE_SSL = {
  826. 'keyfile': '/var/ssl/private/worker-key.pem',
  827. 'certfile': '/var/ssl/amqp-server-cert.pem',
  828. 'ca_certs': '/var/ssl/myca.pem',
  829. 'cert_reqs': ssl.CERT_REQUIRED
  830. }
  831. .. warning::
  832. Be careful using ``BROKER_USE_SSL=True``, it is possible that your default
  833. configuration do not validate the server cert at all, please read Python
  834. `ssl module security
  835. considerations <https://docs.python.org/3/library/ssl.html#ssl-security>`_.
  836. .. setting:: BROKER_POOL_LIMIT
  837. BROKER_POOL_LIMIT
  838. ~~~~~~~~~~~~~~~~~
  839. .. versionadded:: 2.3
  840. The maximum number of connections that can be open in the connection pool.
  841. The pool is enabled by default since version 2.5, with a default limit of ten
  842. connections. This number can be tweaked depending on the number of
  843. threads/greenthreads (eventlet/gevent) using a connection. For example
  844. running eventlet with 1000 greenlets that use a connection to the broker,
  845. contention can arise and you should consider increasing the limit.
  846. If set to :const:`None` or 0 the connection pool will be disabled and
  847. connections will be established and closed for every use.
  848. Default (since 2.5) is to use a pool of 10 connections.
  849. .. setting:: BROKER_CONNECTION_TIMEOUT
  850. BROKER_CONNECTION_TIMEOUT
  851. ~~~~~~~~~~~~~~~~~~~~~~~~~
  852. The default timeout in seconds before we give up establishing a connection
  853. to the AMQP server. Default is 4 seconds.
  854. .. setting:: BROKER_CONNECTION_RETRY
  855. BROKER_CONNECTION_RETRY
  856. ~~~~~~~~~~~~~~~~~~~~~~~
  857. Automatically try to re-establish the connection to the AMQP broker if lost.
  858. The time between retries is increased for each retry, and is
  859. not exhausted before :setting:`BROKER_CONNECTION_MAX_RETRIES` is
  860. exceeded.
  861. This behavior is on by default.
  862. .. setting:: BROKER_CONNECTION_MAX_RETRIES
  863. BROKER_CONNECTION_MAX_RETRIES
  864. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  865. Maximum number of retries before we give up re-establishing a connection
  866. to the AMQP broker.
  867. If this is set to :const:`0` or :const:`None`, we will retry forever.
  868. Default is 100 retries.
  869. .. setting:: BROKER_LOGIN_METHOD
  870. BROKER_LOGIN_METHOD
  871. ~~~~~~~~~~~~~~~~~~~
  872. Set custom amqp login method, default is ``AMQPLAIN``.
  873. .. setting:: BROKER_TRANSPORT_OPTIONS
  874. BROKER_TRANSPORT_OPTIONS
  875. ~~~~~~~~~~~~~~~~~~~~~~~~
  876. .. versionadded:: 2.2
  877. A dict of additional options passed to the underlying transport.
  878. See your transport user manual for supported options (if any).
  879. Example setting the visibility timeout (supported by Redis and SQS
  880. transports):
  881. .. code-block:: python
  882. BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 18000} # 5 hours
  883. .. _conf-task-execution:
  884. Task execution settings
  885. -----------------------
  886. .. setting:: CELERY_ALWAYS_EAGER
  887. CELERY_ALWAYS_EAGER
  888. ~~~~~~~~~~~~~~~~~~~
  889. If this is :const:`True`, all tasks will be executed locally by blocking until
  890. the task returns. ``apply_async()`` and ``Task.delay()`` will return
  891. an :class:`~celery.result.EagerResult` instance, which emulates the API
  892. and behavior of :class:`~celery.result.AsyncResult`, except the result
  893. is already evaluated.
  894. That is, tasks will be executed locally instead of being sent to
  895. the queue.
  896. .. setting:: CELERY_EAGER_PROPAGATES_EXCEPTIONS
  897. CELERY_EAGER_PROPAGATES_EXCEPTIONS
  898. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  899. If this is :const:`True`, eagerly executed tasks (applied by `task.apply()`,
  900. or when the :setting:`CELERY_ALWAYS_EAGER` setting is enabled), will
  901. propagate exceptions.
  902. It's the same as always running ``apply()`` with ``throw=True``.
  903. .. setting:: CELERY_IGNORE_RESULT
  904. CELERY_IGNORE_RESULT
  905. ~~~~~~~~~~~~~~~~~~~~
  906. Whether to store the task return values or not (tombstones).
  907. If you still want to store errors, just not successful return values,
  908. you can set :setting:`CELERY_STORE_ERRORS_EVEN_IF_IGNORED`.
  909. .. setting:: CELERY_MESSAGE_COMPRESSION
  910. CELERY_MESSAGE_COMPRESSION
  911. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  912. Default compression used for task messages.
  913. Can be ``gzip``, ``bzip2`` (if available), or any custom
  914. compression schemes registered in the Kombu compression registry.
  915. The default is to send uncompressed messages.
  916. .. setting:: CELERY_TASK_PROTOCOL
  917. CELERY_TASK_PROTOCOL
  918. ~~~~~~~~~~~~~~~~~~~~
  919. Default task message protocol version.
  920. Supports protocols: 1 and 2 (default is 1 for backwards compatibility).
  921. .. setting:: CELERY_TASK_RESULT_EXPIRES
  922. CELERY_TASK_RESULT_EXPIRES
  923. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  924. Time (in seconds, or a :class:`~datetime.timedelta` object) for when after
  925. stored task tombstones will be deleted.
  926. A built-in periodic task will delete the results after this time
  927. (``celery.backend_cleanup``), assuming that ``celery beat`` is
  928. enabled. The task runs daily at 4am.
  929. A value of :const:`None` or 0 means results will never expire (depending
  930. on backend specifications).
  931. Default is to expire after 1 day.
  932. .. note::
  933. For the moment this only works with the amqp, database, cache, redis and MongoDB
  934. backends.
  935. When using the database or MongoDB backends, `celery beat` must be
  936. running for the results to be expired.
  937. .. setting:: CELERY_MAX_CACHED_RESULTS
  938. CELERY_MAX_CACHED_RESULTS
  939. ~~~~~~~~~~~~~~~~~~~~~~~~~
  940. Result backends caches ready results used by the client.
  941. This is the total number of results to cache before older results are evicted.
  942. The default is 5000. 0 or None means no limit, and a value of :const:`-1`
  943. will disable the cache.
  944. .. setting:: CELERY_TRACK_STARTED
  945. CELERY_TRACK_STARTED
  946. ~~~~~~~~~~~~~~~~~~~~
  947. If :const:`True` the task will report its status as "started" when the
  948. task is executed by a worker. The default value is :const:`False` as
  949. the normal behaviour is to not report that level of granularity. Tasks
  950. are either pending, finished, or waiting to be retried. Having a "started"
  951. state can be useful for when there are long running tasks and there is a
  952. need to report which task is currently running.
  953. .. setting:: CELERY_TASK_SERIALIZER
  954. CELERY_TASK_SERIALIZER
  955. ~~~~~~~~~~~~~~~~~~~~~~
  956. A string identifying the default serialization method to use. Can be
  957. `pickle` (default), `json`, `yaml`, `msgpack` or any custom serialization
  958. methods that have been registered with :mod:`kombu.serialization.registry`.
  959. .. seealso::
  960. :ref:`calling-serializers`.
  961. .. setting:: CELERY_TASK_PUBLISH_RETRY
  962. CELERY_TASK_PUBLISH_RETRY
  963. ~~~~~~~~~~~~~~~~~~~~~~~~~
  964. .. versionadded:: 2.2
  965. Decides if publishing task messages will be retried in the case
  966. of connection loss or other connection errors.
  967. See also :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY`.
  968. Enabled by default.
  969. .. setting:: CELERY_TASK_PUBLISH_RETRY_POLICY
  970. CELERY_TASK_PUBLISH_RETRY_POLICY
  971. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  972. .. versionadded:: 2.2
  973. Defines the default policy when retrying publishing a task message in
  974. the case of connection loss or other connection errors.
  975. See :ref:`calling-retry` for more information.
  976. .. setting:: CELERY_DEFAULT_RATE_LIMIT
  977. CELERY_DEFAULT_RATE_LIMIT
  978. ~~~~~~~~~~~~~~~~~~~~~~~~~
  979. The global default rate limit for tasks.
  980. This value is used for tasks that does not have a custom rate limit
  981. The default is no rate limit.
  982. .. setting:: CELERY_DISABLE_RATE_LIMITS
  983. CELERY_DISABLE_RATE_LIMITS
  984. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  985. Disable all rate limits, even if tasks has explicit rate limits set.
  986. .. setting:: CELERY_ACKS_LATE
  987. CELERY_ACKS_LATE
  988. ~~~~~~~~~~~~~~~~
  989. Late ack means the task messages will be acknowledged **after** the task
  990. has been executed, not *just before*, which is the default behavior.
  991. .. seealso::
  992. FAQ: :ref:`faq-acks_late-vs-retry`.
  993. .. setting:: CELERY_REJECT_ON_WORKER_LOST
  994. CELERY_REJECT_ON_WORKER_LOST
  995. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  996. Even if :attr:`acks_late` is enabled, the worker will
  997. acknowledge tasks when the worker process executing them abrubtly
  998. exits or is signalled (e.g. :sig:`KILL`/:sig:`INT`, etc).
  999. Setting this to true allows the message to be requeued instead,
  1000. so that the task will execute again by the same worker, or another
  1001. worker.
  1002. .. warning::
  1003. Enabling this can cause message loops; make sure you know
  1004. what you're doing.
  1005. .. _conf-worker:
  1006. Worker
  1007. ------
  1008. .. setting:: CELERY_IMPORTS
  1009. CELERY_IMPORTS
  1010. ~~~~~~~~~~~~~~
  1011. A sequence of modules to import when the worker starts.
  1012. This is used to specify the task modules to import, but also
  1013. to import signal handlers and additional remote control commands, etc.
  1014. The modules will be imported in the original order.
  1015. .. setting:: CELERY_INCLUDE
  1016. CELERY_INCLUDE
  1017. ~~~~~~~~~~~~~~
  1018. Exact same semantics as :setting:`CELERY_IMPORTS`, but can be used as a means
  1019. to have different import categories.
  1020. The modules in this setting are imported after the modules in
  1021. :setting:`CELERY_IMPORTS`.
  1022. .. setting:: CELERYD_WORKER_LOST_WAIT
  1023. CELERYD_WORKER_LOST_WAIT
  1024. ~~~~~~~~~~~~~~~~~~~~~~~~
  1025. In some cases a worker may be killed without proper cleanup,
  1026. and the worker may have published a result before terminating.
  1027. This value specifies how long we wait for any missing results before
  1028. raising a :exc:`@WorkerLostError` exception.
  1029. Default is 10.0
  1030. .. setting:: CELERYD_MAX_TASKS_PER_CHILD
  1031. CELERYD_MAX_TASKS_PER_CHILD
  1032. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1033. Maximum number of tasks a pool worker process can execute before
  1034. it's replaced with a new one. Default is no limit.
  1035. .. setting:: CELERYD_TASK_TIME_LIMIT
  1036. CELERYD_TASK_TIME_LIMIT
  1037. ~~~~~~~~~~~~~~~~~~~~~~~
  1038. Task hard time limit in seconds. The worker processing the task will
  1039. be killed and replaced with a new one when this is exceeded.
  1040. .. setting:: CELERYD_TASK_SOFT_TIME_LIMIT
  1041. CELERYD_TASK_SOFT_TIME_LIMIT
  1042. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1043. Task soft time limit in seconds.
  1044. The :exc:`~@SoftTimeLimitExceeded` exception will be
  1045. raised when this is exceeded. The task can catch this to
  1046. e.g. clean up before the hard time limit comes.
  1047. Example:
  1048. .. code-block:: python
  1049. from celery.exceptions import SoftTimeLimitExceeded
  1050. @app.task
  1051. def mytask():
  1052. try:
  1053. return do_work()
  1054. except SoftTimeLimitExceeded:
  1055. cleanup_in_a_hurry()
  1056. .. setting:: CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  1057. CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  1058. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1059. If set, the worker stores all task errors in the result store even if
  1060. :attr:`Task.ignore_result <celery.task.base.Task.ignore_result>` is on.
  1061. .. setting:: CELERYD_STATE_DB
  1062. CELERYD_STATE_DB
  1063. ~~~~~~~~~~~~~~~~
  1064. Name of the file used to stores persistent worker state (like revoked tasks).
  1065. Can be a relative or absolute path, but be aware that the suffix `.db`
  1066. may be appended to the file name (depending on Python version).
  1067. Can also be set via the :option:`--statedb` argument to
  1068. :mod:`~celery.bin.worker`.
  1069. Not enabled by default.
  1070. .. setting:: CELERYD_TIMER_PRECISION
  1071. CELERYD_TIMER_PRECISION
  1072. ~~~~~~~~~~~~~~~~~~~~~~~
  1073. Set the maximum time in seconds that the ETA scheduler can sleep between
  1074. rechecking the schedule. Default is 1 second.
  1075. Setting this value to 1 second means the schedulers precision will
  1076. be 1 second. If you need near millisecond precision you can set this to 0.1.
  1077. .. setting:: CELERY_ENABLE_REMOTE_CONTROL
  1078. CELERY_ENABLE_REMOTE_CONTROL
  1079. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1080. Specify if remote control of the workers is enabled.
  1081. Default is :const:`True`.
  1082. .. _conf-error-mails:
  1083. Error E-Mails
  1084. -------------
  1085. .. setting:: CELERY_SEND_TASK_ERROR_EMAILS
  1086. CELERY_SEND_TASK_ERROR_EMAILS
  1087. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1088. The default value for the `Task.send_error_emails` attribute, which if
  1089. set to :const:`True` means errors occurring during task execution will be
  1090. sent to :setting:`ADMINS` by email.
  1091. Disabled by default.
  1092. .. setting:: ADMINS
  1093. ADMINS
  1094. ~~~~~~
  1095. List of `(name, email_address)` tuples for the administrators that should
  1096. receive error emails.
  1097. .. setting:: SERVER_EMAIL
  1098. SERVER_EMAIL
  1099. ~~~~~~~~~~~~
  1100. The email address this worker sends emails from.
  1101. Default is celery@localhost.
  1102. .. setting:: EMAIL_HOST
  1103. EMAIL_HOST
  1104. ~~~~~~~~~~
  1105. The mail server to use. Default is ``localhost``.
  1106. .. setting:: EMAIL_HOST_USER
  1107. EMAIL_HOST_USER
  1108. ~~~~~~~~~~~~~~~
  1109. User name (if required) to log on to the mail server with.
  1110. .. setting:: EMAIL_HOST_PASSWORD
  1111. EMAIL_HOST_PASSWORD
  1112. ~~~~~~~~~~~~~~~~~~~
  1113. Password (if required) to log on to the mail server with.
  1114. .. setting:: EMAIL_PORT
  1115. EMAIL_PORT
  1116. ~~~~~~~~~~
  1117. The port the mail server is listening on. Default is `25`.
  1118. .. setting:: EMAIL_USE_SSL
  1119. EMAIL_USE_SSL
  1120. ~~~~~~~~~~~~~
  1121. Use SSL when connecting to the SMTP server. Disabled by default.
  1122. .. setting:: EMAIL_USE_TLS
  1123. EMAIL_USE_TLS
  1124. ~~~~~~~~~~~~~
  1125. Use TLS when connecting to the SMTP server. Disabled by default.
  1126. .. setting:: EMAIL_TIMEOUT
  1127. EMAIL_TIMEOUT
  1128. ~~~~~~~~~~~~~
  1129. Timeout in seconds for when we give up trying to connect
  1130. to the SMTP server when sending emails.
  1131. The default is 2 seconds.
  1132. EMAIL_CHARSET
  1133. ~~~~~~~~~~~~~
  1134. .. versionadded:: 4.0
  1135. Charset for outgoing emails. Default is "us-ascii".
  1136. .. setting:: EMAIL_CHARSET
  1137. .. _conf-example-error-mail-config:
  1138. Example E-Mail configuration
  1139. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1140. This configuration enables the sending of error emails to
  1141. george@vandelay.com and kramer@vandelay.com:
  1142. .. code-block:: python
  1143. # Enables error emails.
  1144. CELERY_SEND_TASK_ERROR_EMAILS = True
  1145. # Name and email addresses of recipients
  1146. ADMINS = (
  1147. ('George Costanza', 'george@vandelay.com'),
  1148. ('Cosmo Kramer', 'kosmo@vandelay.com'),
  1149. )
  1150. # Email address used as sender (From field).
  1151. SERVER_EMAIL = 'no-reply@vandelay.com'
  1152. # Mailserver configuration
  1153. EMAIL_HOST = 'mail.vandelay.com'
  1154. EMAIL_PORT = 25
  1155. # EMAIL_HOST_USER = 'servers'
  1156. # EMAIL_HOST_PASSWORD = 's3cr3t'
  1157. .. _conf-events:
  1158. Events
  1159. ------
  1160. .. setting:: CELERY_SEND_EVENTS
  1161. CELERY_SEND_EVENTS
  1162. ~~~~~~~~~~~~~~~~~~
  1163. Send task-related events so that tasks can be monitored using tools like
  1164. `flower`. Sets the default value for the workers :option:`-E` argument.
  1165. .. setting:: CELERY_SEND_TASK_SENT_EVENT
  1166. CELERY_SEND_TASK_SENT_EVENT
  1167. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1168. .. versionadded:: 2.2
  1169. If enabled, a :event:`task-sent` event will be sent for every task so tasks can be
  1170. tracked before they are consumed by a worker.
  1171. Disabled by default.
  1172. .. setting:: CELERY_EVENT_QUEUE_TTL
  1173. CELERY_EVENT_QUEUE_TTL
  1174. ~~~~~~~~~~~~~~~~~~~~~~
  1175. :transports supported: ``amqp``
  1176. Message expiry time in seconds (int/float) for when messages sent to a monitor clients
  1177. event queue is deleted (``x-message-ttl``)
  1178. For example, if this value is set to 10 then a message delivered to this queue
  1179. will be deleted after 10 seconds.
  1180. Disabled by default.
  1181. .. setting:: CELERY_EVENT_QUEUE_EXPIRES
  1182. CELERY_EVENT_QUEUE_EXPIRES
  1183. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1184. :transports supported: ``amqp``
  1185. Expiry time in seconds (int/float) for when after a monitor clients
  1186. event queue will be deleted (``x-expires``).
  1187. Default is never, relying on the queue autodelete setting.
  1188. .. setting:: CELERY_EVENT_SERIALIZER
  1189. CELERY_EVENT_SERIALIZER
  1190. ~~~~~~~~~~~~~~~~~~~~~~~
  1191. Message serialization format used when sending event messages.
  1192. Default is ``json``. See :ref:`calling-serializers`.
  1193. .. _conf-broadcast:
  1194. Broadcast Commands
  1195. ------------------
  1196. .. setting:: CELERY_BROADCAST_QUEUE
  1197. CELERY_BROADCAST_QUEUE
  1198. ~~~~~~~~~~~~~~~~~~~~~~
  1199. Name prefix for the queue used when listening for broadcast messages.
  1200. The workers host name will be appended to the prefix to create the final
  1201. queue name.
  1202. Default is ``celeryctl``.
  1203. .. setting:: CELERY_BROADCAST_EXCHANGE
  1204. CELERY_BROADCAST_EXCHANGE
  1205. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1206. Name of the exchange used for broadcast messages.
  1207. Default is ``celeryctl``.
  1208. .. setting:: CELERY_BROADCAST_EXCHANGE_TYPE
  1209. CELERY_BROADCAST_EXCHANGE_TYPE
  1210. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1211. Exchange type used for broadcast messages. Default is ``fanout``.
  1212. .. _conf-logging:
  1213. Logging
  1214. -------
  1215. .. setting:: CELERYD_HIJACK_ROOT_LOGGER
  1216. CELERYD_HIJACK_ROOT_LOGGER
  1217. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1218. .. versionadded:: 2.2
  1219. By default any previously configured handlers on the root logger will be
  1220. removed. If you want to customize your own logging handlers, then you
  1221. can disable this behavior by setting
  1222. `CELERYD_HIJACK_ROOT_LOGGER = False`.
  1223. .. note::
  1224. Logging can also be customized by connecting to the
  1225. :signal:`celery.signals.setup_logging` signal.
  1226. .. setting:: CELERYD_LOG_COLOR
  1227. CELERYD_LOG_COLOR
  1228. ~~~~~~~~~~~~~~~~~
  1229. Enables/disables colors in logging output by the Celery apps.
  1230. By default colors are enabled if
  1231. 1) the app is logging to a real terminal, and not a file.
  1232. 2) the app is not running on Windows.
  1233. .. setting:: CELERYD_LOG_FORMAT
  1234. CELERYD_LOG_FORMAT
  1235. ~~~~~~~~~~~~~~~~~~
  1236. The format to use for log messages.
  1237. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  1238. See the Python :mod:`logging` module for more information about log
  1239. formats.
  1240. .. setting:: CELERYD_TASK_LOG_FORMAT
  1241. CELERYD_TASK_LOG_FORMAT
  1242. ~~~~~~~~~~~~~~~~~~~~~~~
  1243. The format to use for log messages logged in tasks. Can be overridden using
  1244. the :option:`--loglevel` option to :mod:`~celery.bin.worker`.
  1245. Default is::
  1246. [%(asctime)s: %(levelname)s/%(processName)s]
  1247. [%(task_name)s(%(task_id)s)] %(message)s
  1248. See the Python :mod:`logging` module for more information about log
  1249. formats.
  1250. .. setting:: CELERY_REDIRECT_STDOUTS
  1251. CELERY_REDIRECT_STDOUTS
  1252. ~~~~~~~~~~~~~~~~~~~~~~~
  1253. If enabled `stdout` and `stderr` will be redirected
  1254. to the current logger.
  1255. Enabled by default.
  1256. Used by :program:`celery worker` and :program:`celery beat`.
  1257. .. setting:: CELERY_REDIRECT_STDOUTS_LEVEL
  1258. CELERY_REDIRECT_STDOUTS_LEVEL
  1259. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1260. The log level output to `stdout` and `stderr` is logged as.
  1261. Can be one of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1262. :const:`ERROR` or :const:`CRITICAL`.
  1263. Default is :const:`WARNING`.
  1264. .. _conf-security:
  1265. Security
  1266. --------
  1267. .. setting:: CELERY_SECURITY_KEY
  1268. CELERY_SECURITY_KEY
  1269. ~~~~~~~~~~~~~~~~~~~
  1270. .. versionadded:: 2.5
  1271. The relative or absolute path to a file containing the private key
  1272. used to sign messages when :ref:`message-signing` is used.
  1273. .. setting:: CELERY_SECURITY_CERTIFICATE
  1274. CELERY_SECURITY_CERTIFICATE
  1275. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1276. .. versionadded:: 2.5
  1277. The relative or absolute path to an X.509 certificate file
  1278. used to sign messages when :ref:`message-signing` is used.
  1279. .. setting:: CELERY_SECURITY_CERT_STORE
  1280. CELERY_SECURITY_CERT_STORE
  1281. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1282. .. versionadded:: 2.5
  1283. The directory containing X.509 certificates used for
  1284. :ref:`message-signing`. Can be a glob with wildcards,
  1285. (for example :file:`/etc/certs/*.pem`).
  1286. .. _conf-custom-components:
  1287. Custom Component Classes (advanced)
  1288. -----------------------------------
  1289. .. setting:: CELERYD_POOL
  1290. CELERYD_POOL
  1291. ~~~~~~~~~~~~
  1292. Name of the pool class used by the worker.
  1293. .. admonition:: Eventlet/Gevent
  1294. Never use this option to select the eventlet or gevent pool.
  1295. You must use the `-P` option instead, otherwise the monkey patching
  1296. will happen too late and things will break in strange and silent ways.
  1297. Default is ``celery.concurrency.prefork:TaskPool``.
  1298. .. setting:: CELERYD_POOL_RESTARTS
  1299. CELERYD_POOL_RESTARTS
  1300. ~~~~~~~~~~~~~~~~~~~~~
  1301. If enabled the worker pool can be restarted using the
  1302. :control:`pool_restart` remote control command.
  1303. Disabled by default.
  1304. .. setting:: CELERYD_AUTOSCALER
  1305. CELERYD_AUTOSCALER
  1306. ~~~~~~~~~~~~~~~~~~
  1307. .. versionadded:: 2.2
  1308. Name of the autoscaler class to use.
  1309. Default is ``celery.worker.autoscale:Autoscaler``.
  1310. .. setting:: CELERYD_AUTORELOADER
  1311. CELERYD_AUTORELOADER
  1312. ~~~~~~~~~~~~~~~~~~~~
  1313. Name of the autoreloader class used by the worker to reload
  1314. Python modules and files that have changed.
  1315. Default is: ``celery.worker.autoreload:Autoreloader``.
  1316. .. setting:: CELERYD_CONSUMER
  1317. CELERYD_CONSUMER
  1318. ~~~~~~~~~~~~~~~~
  1319. Name of the consumer class used by the worker.
  1320. Default is :class:`celery.worker.consumer.Consumer`
  1321. .. setting:: CELERYD_TIMER
  1322. CELERYD_TIMER
  1323. ~~~~~~~~~~~~~~~~~~~~~
  1324. Name of the ETA scheduler class used by the worker.
  1325. Default is :class:`celery.utils.timer2.Timer`, or one overrided
  1326. by the pool implementation.
  1327. .. _conf-celerybeat:
  1328. Periodic Task Server: celery beat
  1329. ---------------------------------
  1330. .. setting:: CELERYBEAT_SCHEDULE
  1331. CELERYBEAT_SCHEDULE
  1332. ~~~~~~~~~~~~~~~~~~~
  1333. The periodic task schedule used by :mod:`~celery.bin.beat`.
  1334. See :ref:`beat-entries`.
  1335. .. setting:: CELERYBEAT_SCHEDULER
  1336. CELERYBEAT_SCHEDULER
  1337. ~~~~~~~~~~~~~~~~~~~~
  1338. The default scheduler class. Default is ``celery.beat:PersistentScheduler``.
  1339. Can also be set via the :option:`-S` argument to
  1340. :mod:`~celery.bin.beat`.
  1341. .. setting:: CELERYBEAT_SCHEDULE_FILENAME
  1342. CELERYBEAT_SCHEDULE_FILENAME
  1343. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1344. Name of the file used by `PersistentScheduler` to store the last run times
  1345. of periodic tasks. Can be a relative or absolute path, but be aware that the
  1346. suffix `.db` may be appended to the file name (depending on Python version).
  1347. Can also be set via the :option:`--schedule` argument to
  1348. :mod:`~celery.bin.beat`.
  1349. .. setting:: CELERYBEAT_SYNC_EVERY
  1350. CELERYBEAT_SYNC_EVERY
  1351. ~~~~~~~~~~~~~~~~~~~~~
  1352. The number of periodic tasks that can be called before another database sync
  1353. is issued.
  1354. Defaults to 0 (sync based on timing - default of 3 minutes as determined by
  1355. scheduler.sync_every). If set to 1, beat will call sync after every task
  1356. message sent.
  1357. .. setting:: CELERYBEAT_MAX_LOOP_INTERVAL
  1358. CELERYBEAT_MAX_LOOP_INTERVAL
  1359. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1360. The maximum number of seconds :mod:`~celery.bin.beat` can sleep
  1361. between checking the schedule.
  1362. The default for this value is scheduler specific.
  1363. For the default celery beat scheduler the value is 300 (5 minutes),
  1364. but for e.g. the django-celery database scheduler it is 5 seconds
  1365. because the schedule may be changed externally, and so it must take
  1366. changes to the schedule into account.
  1367. Also when running celery beat embedded (:option:`-B`) on Jython as a thread
  1368. the max interval is overridden and set to 1 so that it's possible
  1369. to shut down in a timely manner.
  1370. .. _conf-celerymon:
  1371. Monitor Server: celerymon
  1372. -------------------------
  1373. .. setting:: CELERYMON_LOG_FORMAT
  1374. CELERYMON_LOG_FORMAT
  1375. ~~~~~~~~~~~~~~~~~~~~
  1376. The format to use for log messages.
  1377. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  1378. See the Python :mod:`logging` module for more information about log
  1379. formats.