configuration.rst 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225
  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. .. _conf-cassandra-result-backend:
  396. Cassandra backend settings
  397. --------------------------
  398. .. note::
  399. The Cassandra backend requires the :mod:`pycassa` library:
  400. http://pypi.python.org/pypi/pycassa/
  401. To install the pycassa package use `pip` or `easy_install`:
  402. .. code-block:: console
  403. $ pip install pycassa
  404. This backend requires the following configuration directives to be set.
  405. .. setting:: CASSANDRA_SERVERS
  406. CASSANDRA_SERVERS
  407. ~~~~~~~~~~~~~~~~~
  408. List of ``host:port`` Cassandra servers. e.g.::
  409. CASSANDRA_SERVERS = ['localhost:9160']
  410. .. setting:: CASSANDRA_KEYSPACE
  411. CASSANDRA_KEYSPACE
  412. ~~~~~~~~~~~~~~~~~~
  413. The keyspace in which to store the results. e.g.::
  414. CASSANDRA_KEYSPACE = 'tasks_keyspace'
  415. .. setting:: CASSANDRA_COLUMN_FAMILY
  416. CASSANDRA_COLUMN_FAMILY
  417. ~~~~~~~~~~~~~~~~~~~~~~~
  418. The column family in which to store the results. e.g.::
  419. CASSANDRA_COLUMN_FAMILY = 'tasks'
  420. .. setting:: CASSANDRA_READ_CONSISTENCY
  421. CASSANDRA_READ_CONSISTENCY
  422. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  423. The read consistency used. Values can be ``ONE``, ``QUORUM`` or ``ALL``.
  424. .. setting:: CASSANDRA_WRITE_CONSISTENCY
  425. CASSANDRA_WRITE_CONSISTENCY
  426. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  427. The write consistency used. Values can be ``ONE``, ``QUORUM`` or ``ALL``.
  428. .. setting:: CASSANDRA_DETAILED_MODE
  429. CASSANDRA_DETAILED_MODE
  430. ~~~~~~~~~~~~~~~~~~~~~~~
  431. Enable or disable detailed mode. Default is :const:`False`.
  432. This mode allows to use the power of Cassandra wide columns to
  433. store all states for a task as a wide column, instead of only the last one.
  434. To use this mode, you need to configure your ColumnFamily to
  435. use the ``TimeUUID`` type as a comparator::
  436. create column family task_results with comparator = TimeUUIDType;
  437. CASSANDRA_OPTIONS
  438. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  439. Options to be passed to the `pycassa connection pool`_ (optional).
  440. .. _`pycassa connection pool`: http://pycassa.github.com/pycassa/api/pycassa/pool.html
  441. Example configuration
  442. ~~~~~~~~~~~~~~~~~~~~~
  443. .. code-block:: python
  444. CASSANDRA_SERVERS = ['localhost:9160']
  445. CASSANDRA_KEYSPACE = 'celery'
  446. CASSANDRA_COLUMN_FAMILY = 'task_results'
  447. CASSANDRA_READ_CONSISTENCY = 'ONE'
  448. CASSANDRA_WRITE_CONSISTENCY = 'ONE'
  449. CASSANDRA_DETAILED_MODE = True
  450. CASSANDRA_OPTIONS = {
  451. 'timeout': 300,
  452. 'max_retries': 10
  453. }
  454. .. _conf-riak-result-backend:
  455. Riak backend settings
  456. ---------------------
  457. .. note::
  458. The Riak backend requires the :mod:`riak` library:
  459. http://pypi.python.org/pypi/riak/
  460. To install the riak package use `pip` or `easy_install`:
  461. .. code-block:: console
  462. $ pip install riak
  463. This backend requires the :setting:`CELERY_RESULT_BACKEND`
  464. setting to be set to a Riak URL::
  465. CELERY_RESULT_BACKEND = "riak://host:port/bucket"
  466. For example::
  467. CELERY_RESULT_BACKEND = "riak://localhost/celery
  468. which is the same as::
  469. CELERY_RESULT_BACKEND = "riak://"
  470. The fields of the URL are defined as follows:
  471. - *host*
  472. Host name or IP address of the Riak server. e.g. `"localhost"`.
  473. - *port*
  474. Port to the Riak server using the protobuf protocol. Default is 8087.
  475. - *bucket*
  476. Bucket name to use. Default is `celery`.
  477. The bucket needs to be a string with ascii characters only.
  478. Altenatively, this backend can be configured with the following configuration directives.
  479. .. setting:: CELERY_RIAK_BACKEND_SETTINGS
  480. CELERY_RIAK_BACKEND_SETTINGS
  481. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  482. This is a dict supporting the following keys:
  483. * host
  484. The host name of the Riak server. Defaults to "localhost".
  485. * port
  486. The port the Riak server is listening to. Defaults to 8087.
  487. * bucket
  488. The bucket name to connect to. Defaults to "celery".
  489. * protocol
  490. The protocol to use to connect to the Riak server. This is not configurable
  491. via :setting:`CELERY_RESULT_BACKEND`
  492. .. _conf-ironcache-result-backend:
  493. IronCache backend settings
  494. --------------------------
  495. .. note::
  496. The IronCache backend requires the :mod:`iron_celery` library:
  497. http://pypi.python.org/pypi/iron_celery
  498. To install the iron_celery package use `pip` or `easy_install`:
  499. .. code-block:: console
  500. $ pip install iron_celery
  501. IronCache is configured via the URL provided in :setting:`CELERY_RESULT_BACKEND`, for example::
  502. CELERY_RESULT_BACKEND = 'ironcache://project_id:token@'
  503. Or to change the cache name::
  504. ironcache:://project_id:token@/awesomecache
  505. For more information, see: https://github.com/iron-io/iron_celery
  506. .. _conf-couchbase-result-backend:
  507. Couchbase backend settings
  508. --------------------------
  509. .. note::
  510. The Couchbase backend requires the :mod:`couchbase` library:
  511. https://pypi.python.org/pypi/couchbase
  512. To install the couchbase package use `pip` or `easy_install`:
  513. .. code-block:: console
  514. $ pip install couchbase
  515. This backend can be configured via the :setting:`CELERY_RESULT_BACKEND`
  516. set to a couchbase URL::
  517. CELERY_RESULT_BACKEND = 'couchbase://username:password@host:port/bucket'
  518. .. setting:: CELERY_COUCHBASE_BACKEND_SETTINGS
  519. CELERY_COUCHBASE_BACKEND_SETTINGS
  520. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  521. This is a dict supporting the following keys:
  522. * host
  523. Host name of the Couchbase server. Defaults to ``localhost``.
  524. * port
  525. The port the Couchbase server is listening to. Defaults to ``8091``.
  526. * bucket
  527. The default bucket the Couchbase server is writing to.
  528. Defaults to ``default``.
  529. * username
  530. User name to authenticate to the Couchbase server as (optional).
  531. * password
  532. Password to authenticate to the Couchbase server (optional).
  533. .. _conf-couchdb-result-backend:
  534. CouchDB backend settings
  535. ------------------------
  536. .. note::
  537. The CouchDB backend requires the :mod:`pycouchdb` library:
  538. https://pypi.python.org/pypi/pycouchdb
  539. To install the couchbase package use `pip` or `easy_install`:
  540. .. code-block:: console
  541. $ pip install pycouchdb
  542. This backend can be configured via the :setting:`CELERY_RESULT_BACKEND`
  543. set to a couchdb URL::
  544. CELERY_RESULT_BACKEND = 'couchdb://username:password@host:port/container'
  545. The URL is formed out of the following parts:
  546. * username
  547. User name to authenticate to the CouchDB server as (optional).
  548. * password
  549. Password to authenticate to the CouchDB server (optional).
  550. * host
  551. Host name of the CouchDB server. Defaults to ``localhost``.
  552. * port
  553. The port the CouchDB server is listening to. Defaults to ``8091``.
  554. * container
  555. The default container the CouchDB server is writing to.
  556. Defaults to ``default``.
  557. AMQP backend settings
  558. ---------------------
  559. .. admonition:: Do not use in production.
  560. This is the old AMQP result backend that creates one queue per task,
  561. if you want to send results back as message please consider using the
  562. RPC backend instead, or if you need the results to be persistent
  563. use a result backend designed for that purpose (e.g. Redis, or a database).
  564. .. note::
  565. The AMQP backend requires RabbitMQ 1.1.0 or higher to automatically
  566. expire results. If you are running an older version of RabbitMQ
  567. you should disable result expiration like this:
  568. CELERY_TASK_RESULT_EXPIRES = None
  569. .. setting:: CELERY_RESULT_EXCHANGE
  570. CELERY_RESULT_EXCHANGE
  571. ~~~~~~~~~~~~~~~~~~~~~~
  572. Name of the exchange to publish results in. Default is `celeryresults`.
  573. .. setting:: CELERY_RESULT_EXCHANGE_TYPE
  574. CELERY_RESULT_EXCHANGE_TYPE
  575. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  576. The exchange type of the result exchange. Default is to use a `direct`
  577. exchange.
  578. .. setting:: CELERY_RESULT_PERSISTENT
  579. CELERY_RESULT_PERSISTENT
  580. ~~~~~~~~~~~~~~~~~~~~~~~~
  581. If set to :const:`True`, result messages will be persistent. This means the
  582. messages will not be lost after a broker restart. The default is for the
  583. results to be transient.
  584. Example configuration
  585. ~~~~~~~~~~~~~~~~~~~~~
  586. .. code-block:: python
  587. CELERY_RESULT_BACKEND = 'amqp'
  588. CELERY_TASK_RESULT_EXPIRES = 18000 # 5 hours.
  589. .. _conf-messaging:
  590. Message Routing
  591. ---------------
  592. .. _conf-messaging-routing:
  593. .. setting:: CELERY_QUEUES
  594. CELERY_QUEUES
  595. ~~~~~~~~~~~~~
  596. Most users will not want to specify this setting and should rather use
  597. the :ref:`automatic routing facilities <routing-automatic>`.
  598. If you really want to configure advanced routing, this setting should
  599. be a list of :class:`kombu.Queue` objects the worker will consume from.
  600. Note that workers can be overriden this setting via the `-Q` option,
  601. or individual queues from this list (by name) can be excluded using
  602. the `-X` option.
  603. Also see :ref:`routing-basics` for more information.
  604. The default is a queue/exchange/binding key of ``celery``, with
  605. exchange type ``direct``.
  606. See also :setting:`CELERY_ROUTES`
  607. .. setting:: CELERY_ROUTES
  608. CELERY_ROUTES
  609. ~~~~~~~~~~~~~
  610. A list of routers, or a single router used to route tasks to queues.
  611. When deciding the final destination of a task the routers are consulted
  612. in order.
  613. A router can be specified as either:
  614. * A router class instances
  615. * A string which provides the path to a router class
  616. * A dict containing router specification. It will be converted to a :class:`celery.routes.MapRoute` instance.
  617. Examples:
  618. .. code-block:: python
  619. CELERY_ROUTES = {"celery.ping": "default",
  620. "mytasks.add": "cpu-bound",
  621. "video.encode": {
  622. "queue": "video",
  623. "exchange": "media"
  624. "routing_key": "media.video.encode"}}
  625. CELERY_ROUTES = ("myapp.tasks.Router", {"celery.ping": "default})
  626. Where ``myapp.tasks.Router`` could be:
  627. .. code-block:: python
  628. class Router(object):
  629. def route_for_task(self, task, args=None, kwargs=None):
  630. if task == "celery.ping":
  631. return "default"
  632. ``route_for_task`` may return a string or a dict. A string then means
  633. it's a queue name in :setting:`CELERY_QUEUES`, a dict means it's a custom route.
  634. When sending tasks, the routers are consulted in order. The first
  635. router that doesn't return ``None`` is the route to use. The message options
  636. is then merged with the found route settings, where the routers settings
  637. have priority.
  638. Example if :func:`~celery.execute.apply_async` has these arguments:
  639. .. code-block:: python
  640. Task.apply_async(immediate=False, exchange="video",
  641. routing_key="video.compress")
  642. and a router returns:
  643. .. code-block:: python
  644. {"immediate": True, "exchange": "urgent"}
  645. the final message options will be:
  646. .. code-block:: python
  647. immediate=True, exchange="urgent", routing_key="video.compress"
  648. (and any default message options defined in the
  649. :class:`~celery.task.base.Task` class)
  650. Values defined in :setting:`CELERY_ROUTES` have precedence over values defined in
  651. :setting:`CELERY_QUEUES` when merging the two.
  652. With the follow settings:
  653. .. code-block:: python
  654. CELERY_QUEUES = {"cpubound": {"exchange": "cpubound",
  655. "routing_key": "cpubound"}}
  656. CELERY_ROUTES = {"tasks.add": {"queue": "cpubound",
  657. "routing_key": "tasks.add",
  658. "serializer": "json"}}
  659. The final routing options for ``tasks.add`` will become:
  660. .. code-block:: javascript
  661. {"exchange": "cpubound",
  662. "routing_key": "tasks.add",
  663. "serializer": "json"}
  664. See :ref:`routers` for more examples.
  665. .. setting:: CELERY_QUEUE_HA_POLICY
  666. CELERY_QUEUE_HA_POLICY
  667. ~~~~~~~~~~~~~~~~~~~~~~
  668. :brokers: RabbitMQ
  669. This will set the default HA policy for a queue, and the value
  670. can either be a string (usually ``all``):
  671. .. code-block:: python
  672. CELERY_QUEUE_HA_POLICY = 'all'
  673. Using 'all' will replicate the queue to all current nodes,
  674. Or you can give it a list of nodes to replicate to:
  675. .. code-block:: python
  676. CELERY_QUEUE_HA_POLICY = ['rabbit@host1', 'rabbit@host2']
  677. Using a list will implicitly set ``x-ha-policy`` to 'nodes' and
  678. ``x-ha-policy-params`` to the given list of nodes.
  679. See http://www.rabbitmq.com/ha.html for more information.
  680. .. setting:: CELERY_WORKER_DIRECT
  681. CELERY_WORKER_DIRECT
  682. ~~~~~~~~~~~~~~~~~~~~
  683. This option enables so that every worker has a dedicated queue,
  684. so that tasks can be routed to specific workers.
  685. The queue name for each worker is automatically generated based on
  686. the worker hostname and a ``.dq`` suffix, using the ``C.dq`` exchange.
  687. For example the queue name for the worker with node name ``w1@example.com``
  688. becomes::
  689. w1@example.com.dq
  690. Then you can route the task to the task by specifying the hostname
  691. as the routing key and the ``C.dq`` exchange::
  692. CELERY_ROUTES = {
  693. 'tasks.add': {'exchange': 'C.dq', 'routing_key': 'w1@example.com'}
  694. }
  695. .. setting:: CELERY_CREATE_MISSING_QUEUES
  696. CELERY_CREATE_MISSING_QUEUES
  697. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  698. If enabled (default), any queues specified that are not defined in
  699. :setting:`CELERY_QUEUES` will be automatically created. See
  700. :ref:`routing-automatic`.
  701. .. setting:: CELERY_DEFAULT_QUEUE
  702. CELERY_DEFAULT_QUEUE
  703. ~~~~~~~~~~~~~~~~~~~~
  704. The name of the default queue used by `.apply_async` if the message has
  705. no route or no custom queue has been specified.
  706. This queue must be listed in :setting:`CELERY_QUEUES`.
  707. If :setting:`CELERY_QUEUES` is not specified then it is automatically
  708. created containing one queue entry, where this name is used as the name of
  709. that queue.
  710. The default is: `celery`.
  711. .. seealso::
  712. :ref:`routing-changing-default-queue`
  713. .. setting:: CELERY_DEFAULT_EXCHANGE
  714. CELERY_DEFAULT_EXCHANGE
  715. ~~~~~~~~~~~~~~~~~~~~~~~
  716. Name of the default exchange to use when no custom exchange is
  717. specified for a key in the :setting:`CELERY_QUEUES` setting.
  718. The default is: `celery`.
  719. .. setting:: CELERY_DEFAULT_EXCHANGE_TYPE
  720. CELERY_DEFAULT_EXCHANGE_TYPE
  721. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  722. Default exchange type used when no custom exchange type is specified
  723. for a key in the :setting:`CELERY_QUEUES` setting.
  724. The default is: `direct`.
  725. .. setting:: CELERY_DEFAULT_ROUTING_KEY
  726. CELERY_DEFAULT_ROUTING_KEY
  727. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  728. The default routing key used when no custom routing key
  729. is specified for a key in the :setting:`CELERY_QUEUES` setting.
  730. The default is: `celery`.
  731. .. setting:: CELERY_DEFAULT_DELIVERY_MODE
  732. CELERY_DEFAULT_DELIVERY_MODE
  733. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  734. Can be `transient` or `persistent`. The default is to send
  735. persistent messages.
  736. .. _conf-broker-settings:
  737. Broker Settings
  738. ---------------
  739. .. setting:: CELERY_ACCEPT_CONTENT
  740. CELERY_ACCEPT_CONTENT
  741. ~~~~~~~~~~~~~~~~~~~~~
  742. A whitelist of content-types/serializers to allow.
  743. If a message is received that is not in this list then
  744. the message will be discarded with an error.
  745. By default any content type is enabled (including pickle and yaml)
  746. so make sure untrusted parties do not have access to your broker.
  747. See :ref:`guide-security` for more.
  748. Example::
  749. # using serializer name
  750. CELERY_ACCEPT_CONTENT = ['json']
  751. # or the actual content-type (MIME)
  752. CELERY_ACCEPT_CONTENT = ['application/json']
  753. .. setting:: BROKER_FAILOVER_STRATEGY
  754. BROKER_FAILOVER_STRATEGY
  755. ~~~~~~~~~~~~~~~~~~~~~~~~
  756. Default failover strategy for the broker Connection object. If supplied,
  757. may map to a key in 'kombu.connection.failover_strategies', or be a reference
  758. to any method that yields a single item from a supplied list.
  759. Example::
  760. # Random failover strategy
  761. def random_failover_strategy(servers):
  762. it = list(it) # don't modify callers list
  763. shuffle = random.shuffle
  764. for _ in repeat(None):
  765. shuffle(it)
  766. yield it[0]
  767. BROKER_FAILOVER_STRATEGY=random_failover_strategy
  768. .. setting:: BROKER_TRANSPORT
  769. BROKER_TRANSPORT
  770. ~~~~~~~~~~~~~~~~
  771. :Aliases: ``BROKER_BACKEND``
  772. :Deprecated aliases: ``CARROT_BACKEND``
  773. .. setting:: BROKER_URL
  774. BROKER_URL
  775. ~~~~~~~~~~
  776. Default broker URL. This must be an URL in the form of::
  777. transport://userid:password@hostname:port/virtual_host
  778. Only the scheme part (``transport://``) is required, the rest
  779. is optional, and defaults to the specific transports default values.
  780. The transport part is the broker implementation to use, and the
  781. default is ``amqp``, which uses ``librabbitmq`` by default or falls back to
  782. ``pyamqp`` if that is not installed. Also there are many other choices including
  783. ``redis``, ``beanstalk``, ``sqlalchemy``, ``django``, ``mongodb``,
  784. ``couchdb``.
  785. It can also be a fully qualified path to your own transport implementation.
  786. More than broker URL, of the same transport, can also be specified.
  787. The broker URLs can be passed in as a single string that is semicolon delimited::
  788. BROKER_URL = 'transport://userid:password@hostname:port//;transport://userid:password@hostname:port//'
  789. Or as a list::
  790. BROKER_URL = [
  791. 'transport://userid:password@localhost:port//',
  792. 'transport://userid:password@hostname:port//'
  793. ]
  794. The brokers will then be used in the :setting:`BROKER_FAILOVER_STRATEGY`.
  795. See :ref:`kombu:connection-urls` in the Kombu documentation for more
  796. information.
  797. .. setting:: BROKER_HEARTBEAT
  798. BROKER_HEARTBEAT
  799. ~~~~~~~~~~~~~~~~
  800. :transports supported: ``pyamqp``
  801. It's not always possible to detect connection loss in a timely
  802. manner using TCP/IP alone, so AMQP defines something called heartbeats
  803. that's is used both by the client and the broker to detect if
  804. a connection was closed.
  805. Heartbeats are disabled by default.
  806. If the heartbeat value is 10 seconds, then
  807. the heartbeat will be monitored at the interval specified
  808. by the :setting:`BROKER_HEARTBEAT_CHECKRATE` setting, which by default is
  809. double the rate of the heartbeat value
  810. (so for the default 10 seconds, the heartbeat is checked every 5 seconds).
  811. .. setting:: BROKER_HEARTBEAT_CHECKRATE
  812. BROKER_HEARTBEAT_CHECKRATE
  813. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  814. :transports supported: ``pyamqp``
  815. At intervals the worker will monitor that the broker has not missed
  816. too many heartbeats. The rate at which this is checked is calculated
  817. by dividing the :setting:`BROKER_HEARTBEAT` value with this value,
  818. so if the heartbeat is 10.0 and the rate is the default 2.0, the check
  819. will be performed every 5 seconds (twice the heartbeat sending rate).
  820. .. setting:: BROKER_USE_SSL
  821. BROKER_USE_SSL
  822. ~~~~~~~~~~~~~~
  823. :transports supported: ``pyamqp``
  824. Toggles SSL usage on broker connection and SSL settings.
  825. If ``True`` the connection will use SSL with default SSL settings.
  826. If set to a dict, will configure SSL connection according to the specified
  827. policy. The format used is python `ssl.wrap_socket()
  828. options <https://docs.python.org/3/library/ssl.html#ssl.wrap_socket>`_.
  829. Default is ``False`` (no SSL).
  830. Note that SSL socket is generally served on a separate port by the broker.
  831. Example providing a client cert and validating the server cert against a custom
  832. certificate authority:
  833. .. code-block:: python
  834. import ssl
  835. BROKER_USE_SSL = {
  836. 'keyfile': '/var/ssl/private/worker-key.pem',
  837. 'certfile': '/var/ssl/amqp-server-cert.pem',
  838. 'ca_certs': '/var/ssl/myca.pem',
  839. 'cert_reqs': ssl.CERT_REQUIRED
  840. }
  841. .. warning::
  842. Be careful using ``BROKER_USE_SSL=True``, it is possible that your default
  843. configuration do not validate the server cert at all, please read Python
  844. `ssl module security
  845. considerations <https://docs.python.org/3/library/ssl.html#ssl-security>`_.
  846. .. setting:: BROKER_POOL_LIMIT
  847. BROKER_POOL_LIMIT
  848. ~~~~~~~~~~~~~~~~~
  849. .. versionadded:: 2.3
  850. The maximum number of connections that can be open in the connection pool.
  851. The pool is enabled by default since version 2.5, with a default limit of ten
  852. connections. This number can be tweaked depending on the number of
  853. threads/greenthreads (eventlet/gevent) using a connection. For example
  854. running eventlet with 1000 greenlets that use a connection to the broker,
  855. contention can arise and you should consider increasing the limit.
  856. If set to :const:`None` or 0 the connection pool will be disabled and
  857. connections will be established and closed for every use.
  858. Default (since 2.5) is to use a pool of 10 connections.
  859. .. setting:: BROKER_CONNECTION_TIMEOUT
  860. BROKER_CONNECTION_TIMEOUT
  861. ~~~~~~~~~~~~~~~~~~~~~~~~~
  862. The default timeout in seconds before we give up establishing a connection
  863. to the AMQP server. Default is 4 seconds.
  864. .. setting:: BROKER_CONNECTION_RETRY
  865. BROKER_CONNECTION_RETRY
  866. ~~~~~~~~~~~~~~~~~~~~~~~
  867. Automatically try to re-establish the connection to the AMQP broker if lost.
  868. The time between retries is increased for each retry, and is
  869. not exhausted before :setting:`BROKER_CONNECTION_MAX_RETRIES` is
  870. exceeded.
  871. This behavior is on by default.
  872. .. setting:: BROKER_CONNECTION_MAX_RETRIES
  873. BROKER_CONNECTION_MAX_RETRIES
  874. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  875. Maximum number of retries before we give up re-establishing a connection
  876. to the AMQP broker.
  877. If this is set to :const:`0` or :const:`None`, we will retry forever.
  878. Default is 100 retries.
  879. .. setting:: BROKER_LOGIN_METHOD
  880. BROKER_LOGIN_METHOD
  881. ~~~~~~~~~~~~~~~~~~~
  882. Set custom amqp login method, default is ``AMQPLAIN``.
  883. .. setting:: BROKER_TRANSPORT_OPTIONS
  884. BROKER_TRANSPORT_OPTIONS
  885. ~~~~~~~~~~~~~~~~~~~~~~~~
  886. .. versionadded:: 2.2
  887. A dict of additional options passed to the underlying transport.
  888. See your transport user manual for supported options (if any).
  889. Example setting the visibility timeout (supported by Redis and SQS
  890. transports):
  891. .. code-block:: python
  892. BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 18000} # 5 hours
  893. .. _conf-task-execution:
  894. Task execution settings
  895. -----------------------
  896. .. setting:: CELERY_ALWAYS_EAGER
  897. CELERY_ALWAYS_EAGER
  898. ~~~~~~~~~~~~~~~~~~~
  899. If this is :const:`True`, all tasks will be executed locally by blocking until
  900. the task returns. ``apply_async()`` and ``Task.delay()`` will return
  901. an :class:`~celery.result.EagerResult` instance, which emulates the API
  902. and behavior of :class:`~celery.result.AsyncResult`, except the result
  903. is already evaluated.
  904. That is, tasks will be executed locally instead of being sent to
  905. the queue.
  906. .. setting:: CELERY_EAGER_PROPAGATES_EXCEPTIONS
  907. CELERY_EAGER_PROPAGATES_EXCEPTIONS
  908. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  909. If this is :const:`True`, eagerly executed tasks (applied by `task.apply()`,
  910. or when the :setting:`CELERY_ALWAYS_EAGER` setting is enabled), will
  911. propagate exceptions.
  912. It's the same as always running ``apply()`` with ``throw=True``.
  913. .. setting:: CELERY_IGNORE_RESULT
  914. CELERY_IGNORE_RESULT
  915. ~~~~~~~~~~~~~~~~~~~~
  916. Whether to store the task return values or not (tombstones).
  917. If you still want to store errors, just not successful return values,
  918. you can set :setting:`CELERY_STORE_ERRORS_EVEN_IF_IGNORED`.
  919. .. setting:: CELERY_MESSAGE_COMPRESSION
  920. CELERY_MESSAGE_COMPRESSION
  921. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  922. Default compression used for task messages.
  923. Can be ``gzip``, ``bzip2`` (if available), or any custom
  924. compression schemes registered in the Kombu compression registry.
  925. The default is to send uncompressed messages.
  926. .. setting:: CELERY_TASK_PROTOCOL
  927. CELERY_TASK_PROTOCOL
  928. ~~~~~~~~~~~~~~~~~~~~
  929. Default task message protocol version.
  930. Supports protocols: 1 and 2 (default is 1 for backwards compatibility).
  931. .. setting:: CELERY_TASK_RESULT_EXPIRES
  932. CELERY_TASK_RESULT_EXPIRES
  933. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  934. Time (in seconds, or a :class:`~datetime.timedelta` object) for when after
  935. stored task tombstones will be deleted.
  936. A built-in periodic task will delete the results after this time
  937. (``celery.backend_cleanup``), assuming that ``celery beat`` is
  938. enabled. The task runs daily at 4am.
  939. A value of :const:`None` or 0 means results will never expire (depending
  940. on backend specifications).
  941. Default is to expire after 1 day.
  942. .. note::
  943. For the moment this only works with the amqp, database, cache, redis and MongoDB
  944. backends.
  945. When using the database or MongoDB backends, `celery beat` must be
  946. running for the results to be expired.
  947. .. setting:: CELERY_MAX_CACHED_RESULTS
  948. CELERY_MAX_CACHED_RESULTS
  949. ~~~~~~~~~~~~~~~~~~~~~~~~~
  950. Result backends caches ready results used by the client.
  951. This is the total number of results to cache before older results are evicted.
  952. The default is 5000. 0 or None means no limit, and a value of :const:`-1`
  953. will disable the cache.
  954. .. setting:: CELERY_TRACK_STARTED
  955. CELERY_TRACK_STARTED
  956. ~~~~~~~~~~~~~~~~~~~~
  957. If :const:`True` the task will report its status as "started" when the
  958. task is executed by a worker. The default value is :const:`False` as
  959. the normal behaviour is to not report that level of granularity. Tasks
  960. are either pending, finished, or waiting to be retried. Having a "started"
  961. state can be useful for when there are long running tasks and there is a
  962. need to report which task is currently running.
  963. .. setting:: CELERY_TASK_SERIALIZER
  964. CELERY_TASK_SERIALIZER
  965. ~~~~~~~~~~~~~~~~~~~~~~
  966. A string identifying the default serialization method to use. Can be
  967. `pickle` (default), `json`, `yaml`, `msgpack` or any custom serialization
  968. methods that have been registered with :mod:`kombu.serialization.registry`.
  969. .. seealso::
  970. :ref:`calling-serializers`.
  971. .. setting:: CELERY_TASK_PUBLISH_RETRY
  972. CELERY_TASK_PUBLISH_RETRY
  973. ~~~~~~~~~~~~~~~~~~~~~~~~~
  974. .. versionadded:: 2.2
  975. Decides if publishing task messages will be retried in the case
  976. of connection loss or other connection errors.
  977. See also :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY`.
  978. Enabled by default.
  979. .. setting:: CELERY_TASK_PUBLISH_RETRY_POLICY
  980. CELERY_TASK_PUBLISH_RETRY_POLICY
  981. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  982. .. versionadded:: 2.2
  983. Defines the default policy when retrying publishing a task message in
  984. the case of connection loss or other connection errors.
  985. See :ref:`calling-retry` for more information.
  986. .. setting:: CELERY_DEFAULT_RATE_LIMIT
  987. CELERY_DEFAULT_RATE_LIMIT
  988. ~~~~~~~~~~~~~~~~~~~~~~~~~
  989. The global default rate limit for tasks.
  990. This value is used for tasks that does not have a custom rate limit
  991. The default is no rate limit.
  992. .. setting:: CELERY_DISABLE_RATE_LIMITS
  993. CELERY_DISABLE_RATE_LIMITS
  994. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  995. Disable all rate limits, even if tasks has explicit rate limits set.
  996. .. setting:: CELERY_ACKS_LATE
  997. CELERY_ACKS_LATE
  998. ~~~~~~~~~~~~~~~~
  999. Late ack means the task messages will be acknowledged **after** the task
  1000. has been executed, not *just before*, which is the default behavior.
  1001. .. seealso::
  1002. FAQ: :ref:`faq-acks_late-vs-retry`.
  1003. .. setting:: CELERY_REJECT_ON_WORKER_LOST
  1004. CELERY_REJECT_ON_WORKER_LOST
  1005. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1006. Even if :attr:`acks_late` is enabled, the worker will
  1007. acknowledge tasks when the worker process executing them abrubtly
  1008. exits or is signalled (e.g. :sig:`KILL`/:sig:`INT`, etc).
  1009. Setting this to true allows the message to be requeued instead,
  1010. so that the task will execute again by the same worker, or another
  1011. worker.
  1012. .. warning::
  1013. Enabling this can cause message loops; make sure you know
  1014. what you're doing.
  1015. .. _conf-worker:
  1016. Worker
  1017. ------
  1018. .. setting:: CELERY_IMPORTS
  1019. CELERY_IMPORTS
  1020. ~~~~~~~~~~~~~~
  1021. A sequence of modules to import when the worker starts.
  1022. This is used to specify the task modules to import, but also
  1023. to import signal handlers and additional remote control commands, etc.
  1024. The modules will be imported in the original order.
  1025. .. setting:: CELERY_INCLUDE
  1026. CELERY_INCLUDE
  1027. ~~~~~~~~~~~~~~
  1028. Exact same semantics as :setting:`CELERY_IMPORTS`, but can be used as a means
  1029. to have different import categories.
  1030. The modules in this setting are imported after the modules in
  1031. :setting:`CELERY_IMPORTS`.
  1032. .. setting:: CELERYD_WORKER_LOST_WAIT
  1033. CELERYD_WORKER_LOST_WAIT
  1034. ~~~~~~~~~~~~~~~~~~~~~~~~
  1035. In some cases a worker may be killed without proper cleanup,
  1036. and the worker may have published a result before terminating.
  1037. This value specifies how long we wait for any missing results before
  1038. raising a :exc:`@WorkerLostError` exception.
  1039. Default is 10.0
  1040. .. setting:: CELERYD_MAX_TASKS_PER_CHILD
  1041. CELERYD_MAX_TASKS_PER_CHILD
  1042. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1043. Maximum number of tasks a pool worker process can execute before
  1044. it's replaced with a new one. Default is no limit.
  1045. .. setting:: CELERYD_TASK_TIME_LIMIT
  1046. CELERYD_TASK_TIME_LIMIT
  1047. ~~~~~~~~~~~~~~~~~~~~~~~
  1048. Task hard time limit in seconds. The worker processing the task will
  1049. be killed and replaced with a new one when this is exceeded.
  1050. .. setting:: CELERYD_TASK_SOFT_TIME_LIMIT
  1051. CELERYD_TASK_SOFT_TIME_LIMIT
  1052. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1053. Task soft time limit in seconds.
  1054. The :exc:`~@SoftTimeLimitExceeded` exception will be
  1055. raised when this is exceeded. The task can catch this to
  1056. e.g. clean up before the hard time limit comes.
  1057. Example:
  1058. .. code-block:: python
  1059. from celery.exceptions import SoftTimeLimitExceeded
  1060. @app.task
  1061. def mytask():
  1062. try:
  1063. return do_work()
  1064. except SoftTimeLimitExceeded:
  1065. cleanup_in_a_hurry()
  1066. .. setting:: CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  1067. CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  1068. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1069. If set, the worker stores all task errors in the result store even if
  1070. :attr:`Task.ignore_result <celery.task.base.Task.ignore_result>` is on.
  1071. .. setting:: CELERYD_STATE_DB
  1072. CELERYD_STATE_DB
  1073. ~~~~~~~~~~~~~~~~
  1074. Name of the file used to stores persistent worker state (like revoked tasks).
  1075. Can be a relative or absolute path, but be aware that the suffix `.db`
  1076. may be appended to the file name (depending on Python version).
  1077. Can also be set via the :option:`--statedb` argument to
  1078. :mod:`~celery.bin.worker`.
  1079. Not enabled by default.
  1080. .. setting:: CELERYD_TIMER_PRECISION
  1081. CELERYD_TIMER_PRECISION
  1082. ~~~~~~~~~~~~~~~~~~~~~~~
  1083. Set the maximum time in seconds that the ETA scheduler can sleep between
  1084. rechecking the schedule. Default is 1 second.
  1085. Setting this value to 1 second means the schedulers precision will
  1086. be 1 second. If you need near millisecond precision you can set this to 0.1.
  1087. .. setting:: CELERY_ENABLE_REMOTE_CONTROL
  1088. CELERY_ENABLE_REMOTE_CONTROL
  1089. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1090. Specify if remote control of the workers is enabled.
  1091. Default is :const:`True`.
  1092. .. _conf-error-mails:
  1093. Error E-Mails
  1094. -------------
  1095. .. setting:: CELERY_SEND_TASK_ERROR_EMAILS
  1096. CELERY_SEND_TASK_ERROR_EMAILS
  1097. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1098. The default value for the `Task.send_error_emails` attribute, which if
  1099. set to :const:`True` means errors occurring during task execution will be
  1100. sent to :setting:`ADMINS` by email.
  1101. Disabled by default.
  1102. .. setting:: ADMINS
  1103. ADMINS
  1104. ~~~~~~
  1105. List of `(name, email_address)` tuples for the administrators that should
  1106. receive error emails.
  1107. .. setting:: SERVER_EMAIL
  1108. SERVER_EMAIL
  1109. ~~~~~~~~~~~~
  1110. The email address this worker sends emails from.
  1111. Default is celery@localhost.
  1112. .. setting:: EMAIL_HOST
  1113. EMAIL_HOST
  1114. ~~~~~~~~~~
  1115. The mail server to use. Default is ``localhost``.
  1116. .. setting:: EMAIL_HOST_USER
  1117. EMAIL_HOST_USER
  1118. ~~~~~~~~~~~~~~~
  1119. User name (if required) to log on to the mail server with.
  1120. .. setting:: EMAIL_HOST_PASSWORD
  1121. EMAIL_HOST_PASSWORD
  1122. ~~~~~~~~~~~~~~~~~~~
  1123. Password (if required) to log on to the mail server with.
  1124. .. setting:: EMAIL_PORT
  1125. EMAIL_PORT
  1126. ~~~~~~~~~~
  1127. The port the mail server is listening on. Default is `25`.
  1128. .. setting:: EMAIL_USE_SSL
  1129. EMAIL_USE_SSL
  1130. ~~~~~~~~~~~~~
  1131. Use SSL when connecting to the SMTP server. Disabled by default.
  1132. .. setting:: EMAIL_USE_TLS
  1133. EMAIL_USE_TLS
  1134. ~~~~~~~~~~~~~
  1135. Use TLS when connecting to the SMTP server. Disabled by default.
  1136. .. setting:: EMAIL_TIMEOUT
  1137. EMAIL_TIMEOUT
  1138. ~~~~~~~~~~~~~
  1139. Timeout in seconds for when we give up trying to connect
  1140. to the SMTP server when sending emails.
  1141. The default is 2 seconds.
  1142. EMAIL_CHARSET
  1143. ~~~~~~~~~~~~~
  1144. .. versionadded:: 4.0
  1145. Charset for outgoing emails. Default is "us-ascii".
  1146. .. setting:: EMAIL_CHARSET
  1147. .. _conf-example-error-mail-config:
  1148. Example E-Mail configuration
  1149. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1150. This configuration enables the sending of error emails to
  1151. george@vandelay.com and kramer@vandelay.com:
  1152. .. code-block:: python
  1153. # Enables error emails.
  1154. CELERY_SEND_TASK_ERROR_EMAILS = True
  1155. # Name and email addresses of recipients
  1156. ADMINS = (
  1157. ('George Costanza', 'george@vandelay.com'),
  1158. ('Cosmo Kramer', 'kosmo@vandelay.com'),
  1159. )
  1160. # Email address used as sender (From field).
  1161. SERVER_EMAIL = 'no-reply@vandelay.com'
  1162. # Mailserver configuration
  1163. EMAIL_HOST = 'mail.vandelay.com'
  1164. EMAIL_PORT = 25
  1165. # EMAIL_HOST_USER = 'servers'
  1166. # EMAIL_HOST_PASSWORD = 's3cr3t'
  1167. .. _conf-events:
  1168. Events
  1169. ------
  1170. .. setting:: CELERY_SEND_EVENTS
  1171. CELERY_SEND_EVENTS
  1172. ~~~~~~~~~~~~~~~~~~
  1173. Send task-related events so that tasks can be monitored using tools like
  1174. `flower`. Sets the default value for the workers :option:`-E` argument.
  1175. .. setting:: CELERY_SEND_TASK_SENT_EVENT
  1176. CELERY_SEND_TASK_SENT_EVENT
  1177. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1178. .. versionadded:: 2.2
  1179. If enabled, a :event:`task-sent` event will be sent for every task so tasks can be
  1180. tracked before they are consumed by a worker.
  1181. Disabled by default.
  1182. .. setting:: CELERY_EVENT_QUEUE_TTL
  1183. CELERY_EVENT_QUEUE_TTL
  1184. ~~~~~~~~~~~~~~~~~~~~~~
  1185. :transports supported: ``amqp``
  1186. Message expiry time in seconds (int/float) for when messages sent to a monitor clients
  1187. event queue is deleted (``x-message-ttl``)
  1188. For example, if this value is set to 10 then a message delivered to this queue
  1189. will be deleted after 10 seconds.
  1190. Disabled by default.
  1191. .. setting:: CELERY_EVENT_QUEUE_EXPIRES
  1192. CELERY_EVENT_QUEUE_EXPIRES
  1193. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1194. :transports supported: ``amqp``
  1195. Expiry time in seconds (int/float) for when after a monitor clients
  1196. event queue will be deleted (``x-expires``).
  1197. Default is never, relying on the queue autodelete setting.
  1198. .. setting:: CELERY_EVENT_SERIALIZER
  1199. CELERY_EVENT_SERIALIZER
  1200. ~~~~~~~~~~~~~~~~~~~~~~~
  1201. Message serialization format used when sending event messages.
  1202. Default is ``json``. See :ref:`calling-serializers`.
  1203. .. _conf-broadcast:
  1204. Broadcast Commands
  1205. ------------------
  1206. .. setting:: CELERY_BROADCAST_QUEUE
  1207. CELERY_BROADCAST_QUEUE
  1208. ~~~~~~~~~~~~~~~~~~~~~~
  1209. Name prefix for the queue used when listening for broadcast messages.
  1210. The workers host name will be appended to the prefix to create the final
  1211. queue name.
  1212. Default is ``celeryctl``.
  1213. .. setting:: CELERY_BROADCAST_EXCHANGE
  1214. CELERY_BROADCAST_EXCHANGE
  1215. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1216. Name of the exchange used for broadcast messages.
  1217. Default is ``celeryctl``.
  1218. .. setting:: CELERY_BROADCAST_EXCHANGE_TYPE
  1219. CELERY_BROADCAST_EXCHANGE_TYPE
  1220. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1221. Exchange type used for broadcast messages. Default is ``fanout``.
  1222. .. _conf-logging:
  1223. Logging
  1224. -------
  1225. .. setting:: CELERYD_HIJACK_ROOT_LOGGER
  1226. CELERYD_HIJACK_ROOT_LOGGER
  1227. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1228. .. versionadded:: 2.2
  1229. By default any previously configured handlers on the root logger will be
  1230. removed. If you want to customize your own logging handlers, then you
  1231. can disable this behavior by setting
  1232. `CELERYD_HIJACK_ROOT_LOGGER = False`.
  1233. .. note::
  1234. Logging can also be customized by connecting to the
  1235. :signal:`celery.signals.setup_logging` signal.
  1236. .. setting:: CELERYD_LOG_COLOR
  1237. CELERYD_LOG_COLOR
  1238. ~~~~~~~~~~~~~~~~~
  1239. Enables/disables colors in logging output by the Celery apps.
  1240. By default colors are enabled if
  1241. 1) the app is logging to a real terminal, and not a file.
  1242. 2) the app is not running on Windows.
  1243. .. setting:: CELERYD_LOG_FORMAT
  1244. CELERYD_LOG_FORMAT
  1245. ~~~~~~~~~~~~~~~~~~
  1246. The format to use for log messages.
  1247. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  1248. See the Python :mod:`logging` module for more information about log
  1249. formats.
  1250. .. setting:: CELERYD_TASK_LOG_FORMAT
  1251. CELERYD_TASK_LOG_FORMAT
  1252. ~~~~~~~~~~~~~~~~~~~~~~~
  1253. The format to use for log messages logged in tasks. Can be overridden using
  1254. the :option:`--loglevel` option to :mod:`~celery.bin.worker`.
  1255. Default is::
  1256. [%(asctime)s: %(levelname)s/%(processName)s]
  1257. [%(task_name)s(%(task_id)s)] %(message)s
  1258. See the Python :mod:`logging` module for more information about log
  1259. formats.
  1260. .. setting:: CELERY_REDIRECT_STDOUTS
  1261. CELERY_REDIRECT_STDOUTS
  1262. ~~~~~~~~~~~~~~~~~~~~~~~
  1263. If enabled `stdout` and `stderr` will be redirected
  1264. to the current logger.
  1265. Enabled by default.
  1266. Used by :program:`celery worker` and :program:`celery beat`.
  1267. .. setting:: CELERY_REDIRECT_STDOUTS_LEVEL
  1268. CELERY_REDIRECT_STDOUTS_LEVEL
  1269. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1270. The log level output to `stdout` and `stderr` is logged as.
  1271. Can be one of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1272. :const:`ERROR` or :const:`CRITICAL`.
  1273. Default is :const:`WARNING`.
  1274. .. _conf-security:
  1275. Security
  1276. --------
  1277. .. setting:: CELERY_SECURITY_KEY
  1278. CELERY_SECURITY_KEY
  1279. ~~~~~~~~~~~~~~~~~~~
  1280. .. versionadded:: 2.5
  1281. The relative or absolute path to a file containing the private key
  1282. used to sign messages when :ref:`message-signing` is used.
  1283. .. setting:: CELERY_SECURITY_CERTIFICATE
  1284. CELERY_SECURITY_CERTIFICATE
  1285. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1286. .. versionadded:: 2.5
  1287. The relative or absolute path to an X.509 certificate file
  1288. used to sign messages when :ref:`message-signing` is used.
  1289. .. setting:: CELERY_SECURITY_CERT_STORE
  1290. CELERY_SECURITY_CERT_STORE
  1291. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1292. .. versionadded:: 2.5
  1293. The directory containing X.509 certificates used for
  1294. :ref:`message-signing`. Can be a glob with wildcards,
  1295. (for example :file:`/etc/certs/*.pem`).
  1296. .. _conf-custom-components:
  1297. Custom Component Classes (advanced)
  1298. -----------------------------------
  1299. .. setting:: CELERYD_POOL
  1300. CELERYD_POOL
  1301. ~~~~~~~~~~~~
  1302. Name of the pool class used by the worker.
  1303. .. admonition:: Eventlet/Gevent
  1304. Never use this option to select the eventlet or gevent pool.
  1305. You must use the `-P` option instead, otherwise the monkey patching
  1306. will happen too late and things will break in strange and silent ways.
  1307. Default is ``celery.concurrency.prefork:TaskPool``.
  1308. .. setting:: CELERYD_POOL_RESTARTS
  1309. CELERYD_POOL_RESTARTS
  1310. ~~~~~~~~~~~~~~~~~~~~~
  1311. If enabled the worker pool can be restarted using the
  1312. :control:`pool_restart` remote control command.
  1313. Disabled by default.
  1314. .. setting:: CELERYD_AUTOSCALER
  1315. CELERYD_AUTOSCALER
  1316. ~~~~~~~~~~~~~~~~~~
  1317. .. versionadded:: 2.2
  1318. Name of the autoscaler class to use.
  1319. Default is ``celery.worker.autoscale:Autoscaler``.
  1320. .. setting:: CELERYD_AUTORELOADER
  1321. CELERYD_AUTORELOADER
  1322. ~~~~~~~~~~~~~~~~~~~~
  1323. Name of the autoreloader class used by the worker to reload
  1324. Python modules and files that have changed.
  1325. Default is: ``celery.worker.autoreload:Autoreloader``.
  1326. .. setting:: CELERYD_CONSUMER
  1327. CELERYD_CONSUMER
  1328. ~~~~~~~~~~~~~~~~
  1329. Name of the consumer class used by the worker.
  1330. Default is :class:`celery.worker.consumer.Consumer`
  1331. .. setting:: CELERYD_TIMER
  1332. CELERYD_TIMER
  1333. ~~~~~~~~~~~~~~~~~~~~~
  1334. Name of the ETA scheduler class used by the worker.
  1335. Default is :class:`celery.utils.timer2.Timer`, or one overrided
  1336. by the pool implementation.
  1337. .. _conf-celerybeat:
  1338. Periodic Task Server: celery beat
  1339. ---------------------------------
  1340. .. setting:: CELERYBEAT_SCHEDULE
  1341. CELERYBEAT_SCHEDULE
  1342. ~~~~~~~~~~~~~~~~~~~
  1343. The periodic task schedule used by :mod:`~celery.bin.beat`.
  1344. See :ref:`beat-entries`.
  1345. .. setting:: CELERYBEAT_SCHEDULER
  1346. CELERYBEAT_SCHEDULER
  1347. ~~~~~~~~~~~~~~~~~~~~
  1348. The default scheduler class. Default is ``celery.beat:PersistentScheduler``.
  1349. Can also be set via the :option:`-S` argument to
  1350. :mod:`~celery.bin.beat`.
  1351. .. setting:: CELERYBEAT_SCHEDULE_FILENAME
  1352. CELERYBEAT_SCHEDULE_FILENAME
  1353. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1354. Name of the file used by `PersistentScheduler` to store the last run times
  1355. of periodic tasks. Can be a relative or absolute path, but be aware that the
  1356. suffix `.db` may be appended to the file name (depending on Python version).
  1357. Can also be set via the :option:`--schedule` argument to
  1358. :mod:`~celery.bin.beat`.
  1359. .. setting:: CELERYBEAT_SYNC_EVERY
  1360. CELERYBEAT_SYNC_EVERY
  1361. ~~~~~~~~~~~~~~~~~~~~~
  1362. The number of periodic tasks that can be called before another database sync
  1363. is issued.
  1364. Defaults to 0 (sync based on timing - default of 3 minutes as determined by
  1365. scheduler.sync_every). If set to 1, beat will call sync after every task
  1366. message sent.
  1367. .. setting:: CELERYBEAT_MAX_LOOP_INTERVAL
  1368. CELERYBEAT_MAX_LOOP_INTERVAL
  1369. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1370. The maximum number of seconds :mod:`~celery.bin.beat` can sleep
  1371. between checking the schedule.
  1372. The default for this value is scheduler specific.
  1373. For the default celery beat scheduler the value is 300 (5 minutes),
  1374. but for e.g. the django-celery database scheduler it is 5 seconds
  1375. because the schedule may be changed externally, and so it must take
  1376. changes to the schedule into account.
  1377. Also when running celery beat embedded (:option:`-B`) on Jython as a thread
  1378. the max interval is overridden and set to 1 so that it's possible
  1379. to shut down in a timely manner.
  1380. .. _conf-celerymon:
  1381. Monitor Server: celerymon
  1382. -------------------------
  1383. .. setting:: CELERYMON_LOG_FORMAT
  1384. CELERYMON_LOG_FORMAT
  1385. ~~~~~~~~~~~~~~~~~~~~
  1386. The format to use for log messages.
  1387. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  1388. See the Python :mod:`logging` module for more information about log
  1389. formats.