configuration.rst 38 KB

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