configuration.rst 41 KB

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