configuration.rst 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708
  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 name of the default queue used by `.apply_async` if the message has
  389. no route or no custom queue has been specified.
  390. This queue must be listed in :setting:`CELERY_QUEUES`.
  391. If :setting:`CELERY_QUEUES` is not specified then it this automatically
  392. created containing one queue entry, where this name is used as the name of
  393. that queue.
  394. The default is: `celery`.
  395. .. seealso::
  396. :ref:`routing-changing-default-queue`
  397. .. setting:: CELERY_DEFAULT_EXCHANGE
  398. CELERY_DEFAULT_EXCHANGE
  399. ~~~~~~~~~~~~~~~~~~~~~~~
  400. Name of the default exchange to use when no custom exchange is
  401. specified for a key in the :setting:`CELERY_QUEUES` setting.
  402. The default is: `celery`.
  403. .. setting:: CELERY_DEFAULT_EXCHANGE_TYPE
  404. CELERY_DEFAULT_EXCHANGE_TYPE
  405. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  406. Default exchange type used when no custom exchange type is specified.
  407. for a key in the :setting:`CELERY_QUEUES` setting.
  408. The default is: `direct`.
  409. .. setting:: CELERY_DEFAULT_ROUTING_KEY
  410. CELERY_DEFAULT_ROUTING_KEY
  411. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  412. The default routing key used when no custom routing key
  413. is specified for a key in the :setting:`CELERY_QUEUES` setting.
  414. The default is: `celery`.
  415. .. setting:: CELERY_DEFAULT_DELIVERY_MODE
  416. CELERY_DEFAULT_DELIVERY_MODE
  417. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  418. Can be `transient` or `persistent`. The default is to send
  419. persistent messages.
  420. .. _conf-broker-settings:
  421. Broker Settings
  422. ---------------
  423. .. setting:: BROKER_TRANSPORT
  424. BROKER_TRANSPORT
  425. ~~~~~~~~~~~~~~~~
  426. :Aliases: ``BROKER_BACKEND``
  427. :Deprecated aliases: ``CARROT_BACKEND``
  428. The Kombu transport to use. Default is ``amqplib``.
  429. You can use a custom transport class name, or select one of the
  430. built-in transports: ``amqplib``, ``pika``, ``redis``, ``beanstalk``,
  431. ``sqlalchemy``, ``django``, ``mongodb``, ``couchdb``.
  432. .. setting:: BROKER_URL
  433. BROKER_URL
  434. ~~~~~~~~~~
  435. Default broker URL. This must be an URL in the form of::
  436. transport://userid:password@hostname:port/virtual_host
  437. Only the scheme part (``transport://``) is required, the rest
  438. is optional, and defaults to the specific transports default values.
  439. If this setting is defined it will override a subset of the
  440. other ``BROKER`` options. These options are :setting:`BROKER_HOST`,
  441. :setting:`BROKER_USER`, :setting:`BROKER_PASSWORD`, :setting:`BROKER_PORT`,
  442. and :setting:`BROKER_VHOST`.
  443. See the Kombu documentation for more information about broker URLs.
  444. .. setting:: BROKER_HOST
  445. BROKER_HOST
  446. ~~~~~~~~~~~
  447. Hostname of the broker.
  448. .. setting:: BROKER_PORT
  449. BROKER_PORT
  450. ~~~~~~~~~~~
  451. Custom port of the broker. Default is to use the default port for the
  452. selected backend.
  453. .. setting:: BROKER_USER
  454. BROKER_USER
  455. ~~~~~~~~~~~
  456. Username to connect as.
  457. .. setting:: BROKER_PASSWORD
  458. BROKER_PASSWORD
  459. ~~~~~~~~~~~~~~~
  460. Password to connect with.
  461. .. setting:: BROKER_VHOST
  462. BROKER_VHOST
  463. ~~~~~~~~~~~~
  464. Virtual host. Default is `"/"`.
  465. .. setting:: BROKER_USE_SSL
  466. BROKER_USE_SSL
  467. ~~~~~~~~~~~~~~
  468. Use SSL to connect to the broker. Off by default. This may not be supported
  469. by all transports.
  470. .. setting:: BROKER_POOL_LIMIT
  471. BROKER_POOL_LIMIT
  472. ~~~~~~~~~~~~~~~~~
  473. .. versionadded:: 2.3
  474. The maximum number of connections that can be open in the connection pool.
  475. The pool is enabled by default since version 2.5, with a default limit of ten
  476. connections. This number can be tweaked depending on the number of
  477. threads/greenthreads (eventlet/gevent) using a connection. For example
  478. running eventlet with 1000 greenlets that use a connection to the broker,
  479. contention can arise and you should consider increasing the limit.
  480. If set to :const:`None` or 0 the connection pool will be disabled and
  481. connections will be established and closed for every use.
  482. Default (since 2.5) is to use a pool of 10 connections.
  483. .. setting:: BROKER_CONNECTION_TIMEOUT
  484. BROKER_CONNECTION_TIMEOUT
  485. ~~~~~~~~~~~~~~~~~~~~~~~~~
  486. The default timeout in seconds before we give up establishing a connection
  487. to the AMQP server. Default is 4 seconds.
  488. .. setting:: BROKER_CONNECTION_RETRY
  489. BROKER_CONNECTION_RETRY
  490. ~~~~~~~~~~~~~~~~~~~~~~~
  491. Automatically try to re-establish the connection to the AMQP broker if lost.
  492. The time between retries is increased for each retry, and is
  493. not exhausted before :setting:`BROKER_CONNECTION_MAX_RETRIES` is
  494. exceeded.
  495. This behavior is on by default.
  496. .. setting:: BROKER_CONNECTION_MAX_RETRIES
  497. BROKER_CONNECTION_MAX_RETRIES
  498. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  499. Maximum number of retries before we give up re-establishing a connection
  500. to the AMQP broker.
  501. If this is set to :const:`0` or :const:`None`, we will retry forever.
  502. Default is 100 retries.
  503. .. setting:: BROKER_TRANSPORT_OPTIONS
  504. BROKER_TRANSPORT_OPTIONS
  505. ~~~~~~~~~~~~~~~~~~~~~~~~
  506. .. versionadded:: 2.2
  507. A dict of additional options passed to the underlying transport.
  508. See your transport user manual for supported options (if any).
  509. .. _conf-task-execution:
  510. Task execution settings
  511. -----------------------
  512. .. setting:: CELERY_ALWAYS_EAGER
  513. CELERY_ALWAYS_EAGER
  514. ~~~~~~~~~~~~~~~~~~~
  515. If this is :const:`True`, all tasks will be executed locally by blocking until
  516. the task returns. ``apply_async()`` and ``Task.delay()`` will return
  517. an :class:`~celery.result.EagerResult` instance, which emulates the API
  518. and behavior of :class:`~celery.result.AsyncResult`, except the result
  519. is already evaluated.
  520. That is, tasks will be executed locally instead of being sent to
  521. the queue.
  522. .. setting:: CELERY_EAGER_PROPAGATES_EXCEPTIONS
  523. CELERY_EAGER_PROPAGATES_EXCEPTIONS
  524. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  525. If this is :const:`True`, eagerly executed tasks (applied by `task.apply()`,
  526. or when the :setting:`CELERY_ALWAYS_EAGER` setting is enabled), will
  527. propagate exceptions.
  528. It's the same as always running ``apply()`` with ``throw=True``.
  529. .. setting:: CELERY_IGNORE_RESULT
  530. CELERY_IGNORE_RESULT
  531. ~~~~~~~~~~~~~~~~~~~~
  532. Whether to store the task return values or not (tombstones).
  533. If you still want to store errors, just not successful return values,
  534. you can set :setting:`CELERY_STORE_ERRORS_EVEN_IF_IGNORED`.
  535. .. setting:: CELERY_MESSAGE_COMPRESSION
  536. CELERY_MESSAGE_COMPRESSION
  537. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  538. Default compression used for task messages.
  539. Can be ``"gzip"``, ``"bzip2"`` (if available), or any custom
  540. compression schemes registered in the Kombu compression registry.
  541. The default is to send uncompressed messages.
  542. .. setting:: CELERY_TASK_RESULT_EXPIRES
  543. CELERY_TASK_RESULT_EXPIRES
  544. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  545. Time (in seconds, or a :class:`~datetime.timedelta` object) for when after
  546. stored task tombstones will be deleted.
  547. A built-in periodic task will delete the results after this time
  548. (:class:`celery.task.backend_cleanup`).
  549. .. note::
  550. For the moment this only works with the amqp, database, cache, redis and MongoDB
  551. backends.
  552. When using the database or MongoDB backends, `celerybeat` must be
  553. running for the results to be expired.
  554. .. setting:: CELERY_MAX_CACHED_RESULTS
  555. CELERY_MAX_CACHED_RESULTS
  556. ~~~~~~~~~~~~~~~~~~~~~~~~~
  557. Result backends caches ready results used by the client.
  558. This is the total number of results to cache before older results are evicted.
  559. The default is 5000.
  560. .. setting:: CELERY_TRACK_STARTED
  561. CELERY_TRACK_STARTED
  562. ~~~~~~~~~~~~~~~~~~~~
  563. If :const:`True` the task will report its status as "started" when the
  564. task is executed by a worker. The default value is :const:`False` as
  565. the normal behaviour is to not report that level of granularity. Tasks
  566. are either pending, finished, or waiting to be retried. Having a "started"
  567. state can be useful for when there are long running tasks and there is a
  568. need to report which task is currently running.
  569. .. setting:: CELERY_TASK_SERIALIZER
  570. CELERY_TASK_SERIALIZER
  571. ~~~~~~~~~~~~~~~~~~~~~~
  572. A string identifying the default serialization method to use. Can be
  573. `pickle` (default), `json`, `yaml`, `msgpack` or any custom serialization
  574. methods that have been registered with :mod:`kombu.serialization.registry`.
  575. .. seealso::
  576. :ref:`executing-serializers`.
  577. .. setting:: CELERY_TASK_PUBLISH_RETRY
  578. CELERY_TASK_PUBLISH_RETRY
  579. ~~~~~~~~~~~~~~~~~~~~~~~~~
  580. .. versionadded:: 2.2
  581. Decides if publishing task messages will be retried in the case
  582. of connection loss or other connection errors.
  583. See also :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY`.
  584. Disabled by default.
  585. .. setting:: CELERY_TASK_PUBLISH_RETRY_POLICY
  586. CELERY_TASK_PUBLISH_RETRY_POLICY
  587. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  588. .. versionadded:: 2.2
  589. Defines the default policy when retrying publishing a task message in
  590. the case of connection loss or other connection errors.
  591. This is a mapping that must contain the following keys:
  592. * `max_retries`
  593. Maximum number of retries before giving up, in this case the
  594. exception that caused the retry to fail will be raised.
  595. A value of 0 or :const:`None` means it will retry forever.
  596. The default is to retry 3 times.
  597. * `interval_start`
  598. Defines the number of seconds (float or integer) to wait between
  599. retries. Default is 0, which means the first retry will be
  600. instantaneous.
  601. * `interval_step`
  602. On each consecutive retry this number will be added to the retry
  603. delay (float or integer). Default is 0.2.
  604. * `interval_max`
  605. Maximum number of seconds (float or integer) to wait between
  606. retries. Default is 0.2.
  607. With the default policy of::
  608. {"max_retries": 3,
  609. "interval_start": 0,
  610. "interval_step": 0.2,
  611. "interval_max": 0.2}
  612. the maximum time spent retrying will be 0.4 seconds. It is set relatively
  613. short by default because a connection failure could lead to a retry pile effect
  614. if the broker connection is down: e.g. many web server processes waiting
  615. to retry blocking other incoming requests.
  616. .. setting:: CELERY_DEFAULT_RATE_LIMIT
  617. CELERY_DEFAULT_RATE_LIMIT
  618. ~~~~~~~~~~~~~~~~~~~~~~~~~
  619. The global default rate limit for tasks.
  620. This value is used for tasks that does not have a custom rate limit
  621. The default is no rate limit.
  622. .. setting:: CELERY_DISABLE_RATE_LIMITS
  623. CELERY_DISABLE_RATE_LIMITS
  624. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  625. Disable all rate limits, even if tasks has explicit rate limits set.
  626. .. setting:: CELERY_ACKS_LATE
  627. CELERY_ACKS_LATE
  628. ~~~~~~~~~~~~~~~~
  629. Late ack means the task messages will be acknowledged **after** the task
  630. has been executed, not *just before*, which is the default behavior.
  631. .. seealso::
  632. FAQ: :ref:`faq-acks_late-vs-retry`.
  633. .. _conf-celeryd:
  634. Worker: celeryd
  635. ---------------
  636. .. setting:: CELERY_IMPORTS
  637. CELERY_IMPORTS
  638. ~~~~~~~~~~~~~~
  639. A sequence of modules to import when the celery daemon starts.
  640. This is used to specify the task modules to import, but also
  641. to import signal handlers and additional remote control commands, etc.
  642. .. setting:: CELERY_INCLUDE
  643. CELERY_INCLUDE
  644. ~~~~~~~~~~~~~~
  645. Exact same semantics as :setting:`CELERY_IMPORTS`, but can be used as a means
  646. to have different import categories.
  647. .. setting:: CELERYD_FORCE_EXECV
  648. CELERYD_FORCE_EXECV
  649. ~~~~~~~~~~~~~~~~~~~
  650. On Unix the processes pool will fork, so that child processes
  651. start with the same memory as the parent process.
  652. This can cause problems as there is a known deadlock condition
  653. with pthread locking primitives when `fork()` is combined with threads.
  654. You should enable this setting if you are experiencing hangs (deadlocks),
  655. especially in combination with time limits or having a max tasks per child limit.
  656. This option will be enabled by default in a later version.
  657. This is not a problem on Windows, as it does not have `fork()`.
  658. .. setting:: CELERYD_WORKER_LOST_WAIT
  659. CELERYD_WORKER_LOST_WAIT
  660. ~~~~~~~~~~~~~~~~~~~~~~~~
  661. In some cases a worker may be killed without proper cleanup,
  662. and the worker may have published a result before terminating.
  663. This value specifies how long we wait for any missing results before
  664. raising a :exc:`@WorkerLostError` exception.
  665. Default is 10.0
  666. .. setting:: CELERYD_MAX_TASKS_PER_CHILD
  667. CELERYD_MAX_TASKS_PER_CHILD
  668. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  669. Maximum number of tasks a pool worker process can execute before
  670. it's replaced with a new one. Default is no limit.
  671. .. setting:: CELERYD_TASK_TIME_LIMIT
  672. CELERYD_TASK_TIME_LIMIT
  673. ~~~~~~~~~~~~~~~~~~~~~~~
  674. Task hard time limit in seconds. The worker processing the task will
  675. be killed and replaced with a new one when this is exceeded.
  676. .. setting:: CELERYD_TASK_SOFT_TIME_LIMIT
  677. CELERYD_TASK_SOFT_TIME_LIMIT
  678. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  679. Task soft time limit in seconds.
  680. The :exc:`~@SoftTimeLimitExceeded` exception will be
  681. raised when this is exceeded. The task can catch this to
  682. e.g. clean up before the hard time limit comes.
  683. Example:
  684. .. code-block:: python
  685. from celery.exceptions import SoftTimeLimitExceeded
  686. @celery.task
  687. def mytask():
  688. try:
  689. return do_work()
  690. except SoftTimeLimitExceeded:
  691. cleanup_in_a_hurry()
  692. .. setting:: CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  693. CELERY_STORE_ERRORS_EVEN_IF_IGNORED
  694. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  695. If set, the worker stores all task errors in the result store even if
  696. :attr:`Task.ignore_result <celery.task.base.Task.ignore_result>` is on.
  697. .. setting:: CELERYD_STATE_DB
  698. CELERYD_STATE_DB
  699. ~~~~~~~~~~~~~~~~
  700. Name of the file used to stores persistent worker state (like revoked tasks).
  701. Can be a relative or absolute path, but be aware that the suffix `.db`
  702. may be appended to the file name (depending on Python version).
  703. Can also be set via the :option:`--statedb` argument to
  704. :mod:`~celery.bin.celeryd`.
  705. Not enabled by default.
  706. .. setting:: CELERYD_TIMER_PRECISION
  707. CELERYD_TIMER_PRECISION
  708. ~~~~~~~~~~~~~~~~~~~~~~~
  709. Set the maximum time in seconds that the ETA scheduler can sleep between
  710. rechecking the schedule. Default is 1 second.
  711. Setting this value to 1 second means the schedulers precision will
  712. be 1 second. If you need near millisecond precision you can set this to 0.1.
  713. .. _conf-error-mails:
  714. Error E-Mails
  715. -------------
  716. .. setting:: CELERY_SEND_TASK_ERROR_EMAILS
  717. CELERY_SEND_TASK_ERROR_EMAILS
  718. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  719. The default value for the `Task.send_error_emails` attribute, which if
  720. set to :const:`True` means errors occurring during task execution will be
  721. sent to :setting:`ADMINS` by email.
  722. Disabled by default.
  723. .. setting:: ADMINS
  724. ADMINS
  725. ~~~~~~
  726. List of `(name, email_address)` tuples for the administrators that should
  727. receive error emails.
  728. .. setting:: SERVER_EMAIL
  729. SERVER_EMAIL
  730. ~~~~~~~~~~~~
  731. The email address this worker sends emails from.
  732. Default is celery@localhost.
  733. .. setting:: EMAIL_HOST
  734. EMAIL_HOST
  735. ~~~~~~~~~~
  736. The mail server to use. Default is `"localhost"`.
  737. .. setting:: EMAIL_HOST_USER
  738. EMAIL_HOST_USER
  739. ~~~~~~~~~~~~~~~
  740. User name (if required) to log on to the mail server with.
  741. .. setting:: EMAIL_HOST_PASSWORD
  742. EMAIL_HOST_PASSWORD
  743. ~~~~~~~~~~~~~~~~~~~
  744. Password (if required) to log on to the mail server with.
  745. .. setting:: EMAIL_PORT
  746. EMAIL_PORT
  747. ~~~~~~~~~~
  748. The port the mail server is listening on. Default is `25`.
  749. .. setting:: EMAIL_USE_SSL
  750. EMAIL_USE_SSL
  751. ~~~~~~~~~~~~~
  752. Use SSL when connecting to the SMTP server. Disabled by default.
  753. .. setting:: EMAIL_USE_TLS
  754. EMAIL_USE_TLS
  755. ~~~~~~~~~~~~~
  756. Use TLS when connecting to the SMTP server. Disabled by default.
  757. .. setting:: EMAIL_TIMEOUT
  758. EMAIL_TIMEOUT
  759. ~~~~~~~~~~~~~
  760. Timeout in seconds for when we give up trying to connect
  761. to the SMTP server when sending emails.
  762. The default is 2 seconds.
  763. .. _conf-example-error-mail-config:
  764. Example E-Mail configuration
  765. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  766. This configuration enables the sending of error emails to
  767. george@vandelay.com and kramer@vandelay.com:
  768. .. code-block:: python
  769. # Enables error emails.
  770. CELERY_SEND_TASK_ERROR_EMAILS = True
  771. # Name and email addresses of recipients
  772. ADMINS = (
  773. ("George Costanza", "george@vandelay.com"),
  774. ("Cosmo Kramer", "kosmo@vandelay.com"),
  775. )
  776. # Email address used as sender (From field).
  777. SERVER_EMAIL = "no-reply@vandelay.com"
  778. # Mailserver configuration
  779. EMAIL_HOST = "mail.vandelay.com"
  780. EMAIL_PORT = 25
  781. # EMAIL_HOST_USER = "servers"
  782. # EMAIL_HOST_PASSWORD = "s3cr3t"
  783. .. _conf-events:
  784. Events
  785. ------
  786. .. setting:: CELERY_SEND_EVENTS
  787. CELERY_SEND_EVENTS
  788. ~~~~~~~~~~~~~~~~~~
  789. Send events so the worker can be monitored by tools like `celerymon`.
  790. .. setting:: CELERY_SEND_TASK_SENT_EVENT
  791. CELERY_SEND_TASK_SENT_EVENT
  792. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  793. .. versionadded:: 2.2
  794. If enabled, a `task-sent` event will be sent for every task so tasks can be
  795. tracked before they are consumed by a worker.
  796. Disabled by default.
  797. .. setting:: CELERY_EVENT_SERIALIZER
  798. CELERY_EVENT_SERIALIZER
  799. ~~~~~~~~~~~~~~~~~~~~~~~
  800. Message serialization format used when sending event messages.
  801. Default is `"json"`. See :ref:`executing-serializers`.
  802. .. _conf-broadcast:
  803. Broadcast Commands
  804. ------------------
  805. .. setting:: CELERY_BROADCAST_QUEUE
  806. CELERY_BROADCAST_QUEUE
  807. ~~~~~~~~~~~~~~~~~~~~~~
  808. Name prefix for the queue used when listening for broadcast messages.
  809. The workers host name will be appended to the prefix to create the final
  810. queue name.
  811. Default is `"celeryctl"`.
  812. .. setting:: CELERY_BROADCAST_EXCHANGE
  813. CELERY_BROADCAST_EXCHANGE
  814. ~~~~~~~~~~~~~~~~~~~~~~~~~
  815. Name of the exchange used for broadcast messages.
  816. Default is `"celeryctl"`.
  817. .. setting:: CELERY_BROADCAST_EXCHANGE_TYPE
  818. CELERY_BROADCAST_EXCHANGE_TYPE
  819. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  820. Exchange type used for broadcast messages. Default is `"fanout"`.
  821. .. _conf-logging:
  822. Logging
  823. -------
  824. .. setting:: CELERYD_HIJACK_ROOT_LOGGER
  825. CELERYD_HIJACK_ROOT_LOGGER
  826. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  827. .. versionadded:: 2.2
  828. By default any previously configured logging options will be reset,
  829. because the Celery programs "hijacks" the root logger.
  830. If you want to customize your own logging then you can disable
  831. this behavior.
  832. .. note::
  833. Logging can also be customized by connecting to the
  834. :signal:`celery.signals.setup_logging` signal.
  835. .. setting:: CELERYD_LOG_COLOR
  836. CELERYD_LOG_COLOR
  837. ~~~~~~~~~~~~~~~~~
  838. Enables/disables colors in logging output by the Celery apps.
  839. By default colors are enabled if
  840. 1) the app is logging to a real terminal, and not a file.
  841. 2) the app is not running on Windows.
  842. .. setting:: CELERYD_LOG_FORMAT
  843. CELERYD_LOG_FORMAT
  844. ~~~~~~~~~~~~~~~~~~
  845. The format to use for log messages.
  846. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  847. See the Python :mod:`logging` module for more information about log
  848. formats.
  849. .. setting:: CELERYD_TASK_LOG_FORMAT
  850. CELERYD_TASK_LOG_FORMAT
  851. ~~~~~~~~~~~~~~~~~~~~~~~
  852. The format to use for log messages logged in tasks. Can be overridden using
  853. the :option:`--loglevel` option to :mod:`~celery.bin.celeryd`.
  854. Default is::
  855. [%(asctime)s: %(levelname)s/%(processName)s]
  856. [%(task_name)s(%(task_id)s)] %(message)s
  857. See the Python :mod:`logging` module for more information about log
  858. formats.
  859. .. setting:: CELERY_REDIRECT_STDOUTS
  860. CELERY_REDIRECT_STDOUTS
  861. ~~~~~~~~~~~~~~~~~~~~~~~
  862. If enabled `stdout` and `stderr` will be redirected
  863. to the current logger.
  864. Enabled by default.
  865. Used by :program:`celeryd` and :program:`celerybeat`.
  866. .. setting:: CELERY_REDIRECT_STDOUTS_LEVEL
  867. CELERY_REDIRECT_STDOUTS_LEVEL
  868. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  869. The log level output to `stdout` and `stderr` is logged as.
  870. Can be one of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  871. :const:`ERROR` or :const:`CRITICAL`.
  872. Default is :const:`WARNING`.
  873. .. _conf-security:
  874. Security
  875. --------
  876. .. setting:: CELERY_SECURITY_KEY
  877. CELERY_SECURITY_KEY
  878. ~~~~~~~~~~~~~~~~~~~
  879. .. versionadded:: 2.5
  880. The relative or absolute path to a file containing the private key
  881. used to sign messages when :ref:`message-signing` is used.
  882. .. setting:: CELERY_SECURITY_CERTIFICATE
  883. CELERY_SECURITY_CERTIFICATE
  884. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  885. .. versionadded:: 2.5
  886. The relative or absolute path to an X.509 certificate file
  887. used to sign messages when :ref:`message-signing` is used.
  888. .. setting:: CELERY_SECURITY_CERT_STORE
  889. CELERY_SECURITY_CERT_STORE
  890. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  891. .. versionadded:: 2.5
  892. The directory containing X.509 certificates used for
  893. :ref:`message-signing`. Can be a glob with wildcards,
  894. (for example :file:`/etc/certs/*.pem`).
  895. .. _conf-custom-components:
  896. Custom Component Classes (advanced)
  897. -----------------------------------
  898. .. setting:: CELERYD_BOOT_STEPS
  899. CELERYD_BOOT_STEPS
  900. ~~~~~~~~~~~~~~~~~~
  901. This setting enables you to add additional components to the worker process.
  902. It should be a list of module names with :class:`celery.abstract.Component`
  903. classes, that augments functionality in the worker.
  904. .. setting:: CELERYD_POOL
  905. CELERYD_POOL
  906. ~~~~~~~~~~~~
  907. Name of the pool class used by the worker.
  908. You can use a custom pool class name, or select one of
  909. the built-in aliases: ``processes``, ``eventlet``, ``gevent``.
  910. Default is ``processes``.
  911. .. setting:: CELERYD_AUTOSCALER
  912. CELERYD_AUTOSCALER
  913. ~~~~~~~~~~~~~~~~~~
  914. .. versionadded:: 2.2
  915. Name of the autoscaler class to use.
  916. Default is ``"celery.worker.autoscale.Autoscaler"``.
  917. .. setting:: CELERYD_AUTORELOADER
  918. CELERYD_AUTORELOADER
  919. ~~~~~~~~~~~~~~~~~~~~
  920. Name of the autoreloader class used by the worker to reload
  921. Python modules and files that have changed.
  922. Default is: ``"celery.worker.autoreload.Autoreloader"``.
  923. .. setting:: CELERYD_CONSUMER
  924. CELERYD_CONSUMER
  925. ~~~~~~~~~~~~~~~~
  926. Name of the consumer class used by the worker.
  927. Default is :class:`celery.worker.consumer.Consumer`
  928. .. setting:: CELERYD_MEDIATOR
  929. CELERYD_MEDIATOR
  930. ~~~~~~~~~~~~~~~~
  931. Name of the mediator class used by the worker.
  932. Default is :class:`celery.worker.controllers.Mediator`.
  933. .. setting:: CELERYD_TIMER
  934. CELERYD_TIMER
  935. ~~~~~~~~~~~~~~~~~~~~~
  936. Name of the ETA scheduler class used by the worker.
  937. Default is :class:`celery.utils.timer2.Timer`, or one overrided
  938. by the pool implementation.
  939. .. _conf-celerybeat:
  940. Periodic Task Server: celerybeat
  941. --------------------------------
  942. .. setting:: CELERYBEAT_SCHEDULE
  943. CELERYBEAT_SCHEDULE
  944. ~~~~~~~~~~~~~~~~~~~
  945. The periodic task schedule used by :mod:`~celery.bin.celerybeat`.
  946. See :ref:`beat-entries`.
  947. .. setting:: CELERYBEAT_SCHEDULER
  948. CELERYBEAT_SCHEDULER
  949. ~~~~~~~~~~~~~~~~~~~~
  950. The default scheduler class. Default is
  951. `"celery.beat.PersistentScheduler"`.
  952. Can also be set via the :option:`-S` argument to
  953. :mod:`~celery.bin.celerybeat`.
  954. .. setting:: CELERYBEAT_SCHEDULE_FILENAME
  955. CELERYBEAT_SCHEDULE_FILENAME
  956. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  957. Name of the file used by `PersistentScheduler` to store the last run times
  958. of periodic tasks. Can be a relative or absolute path, but be aware that the
  959. suffix `.db` may be appended to the file name (depending on Python version).
  960. Can also be set via the :option:`--schedule` argument to
  961. :mod:`~celery.bin.celerybeat`.
  962. .. setting:: CELERYBEAT_MAX_LOOP_INTERVAL
  963. CELERYBEAT_MAX_LOOP_INTERVAL
  964. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  965. The maximum number of seconds :mod:`~celery.bin.celerybeat` can sleep
  966. between checking the schedule.
  967. The default for this value is scheduler specific.
  968. For the default celerybeat scheduler the value is 300 (5 minutes),
  969. but for e.g. the django-celery database scheduler it is 5 seconds
  970. because the schedule may be changed externally, and so it must take
  971. changes to the schedule into account.
  972. Also when running celerybeat embedded (:option:`-B`) on Jython as a thread
  973. the max interval is overridden and set to 1 so that it's possible
  974. to shut down in a timely manner.
  975. .. _conf-celerymon:
  976. Monitor Server: celerymon
  977. -------------------------
  978. .. setting:: CELERYMON_LOG_FORMAT
  979. CELERYMON_LOG_FORMAT
  980. ~~~~~~~~~~~~~~~~~~~~
  981. The format to use for log messages.
  982. Default is `[%(asctime)s: %(levelname)s/%(processName)s] %(message)s`
  983. See the Python :mod:`logging` module for more information about log
  984. formats.
  985. .. _conf-deprecated:
  986. Deprecated Settings
  987. -------------------
  988. These settings have been deprecated and should no longer used,
  989. as they will be removed in future versions.
  990. .. setting:: CELERY_AMQP_TASK_RESULT_EXPIRES
  991. CELERY_AMQP_TASK_RESULT_EXPIRES
  992. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  993. .. deprecated:: 2.5
  994. The time in seconds of which the task result queues should expire.
  995. This setting is deprecated, and will be removed in version 3.0.
  996. Please use :setting:`CELERY_TASK_RESULT_EXPIRES` instead.
  997. .. note::
  998. AMQP result expiration requires RabbitMQ versions 2.1.0 or higher.
  999. .. setting:: CELERY_TASK_ERROR_WHITELIST
  1000. CELERY_TASK_ERROR_WHITELIST
  1001. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1002. .. deprecated:: 2.5
  1003. A white list of exceptions to send error emails for.
  1004. This option is pending deprecation and is scheduled for removal
  1005. in version 3.0.
  1006. .. setting:: CELERYD_LOG_FILE
  1007. CELERYD_LOG_FILE
  1008. ~~~~~~~~~~~~~~~~
  1009. .. deprecated:: 2.4
  1010. This option is deprecated and is scheduled for removal in version 3.0.
  1011. Please use the :option:`--logfile` argument instead.
  1012. The default file name the worker daemon logs messages to. Can be overridden
  1013. using the :option:`--logfile` option to :mod:`~celery.bin.celeryd`.
  1014. The default is :const:`None` (`stderr`)
  1015. .. setting:: CELERYD_LOG_LEVEL
  1016. CELERYD_LOG_LEVEL
  1017. ~~~~~~~~~~~~~~~~~
  1018. .. deprecated:: 2.4
  1019. This option is deprecated and is scheduled for removal in version 3.0.
  1020. Please use the :option:`--loglevel` argument instead.
  1021. Worker log level, can be one of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1022. :const:`ERROR` or :const:`CRITICAL`.
  1023. Can also be set via the :option:`--loglevel` argument to
  1024. :mod:`~celery.bin.celeryd`.
  1025. See the :mod:`logging` module for more information.
  1026. .. setting:: CELERYBEAT_LOG_FILE
  1027. CELERYBEAT_LOG_FILE
  1028. ~~~~~~~~~~~~~~~~~~~
  1029. .. deprecated:: 2.4
  1030. This option is deprecated and is scheduled for removal in version 3.0.
  1031. Please use the :option:`--logfile` argument instead.
  1032. The default file name to log messages to. Can be overridden using
  1033. the `--logfile` option to :mod:`~celery.bin.celerybeat`.
  1034. The default is :const:`None` (`stderr`).
  1035. .. setting:: CELERYBEAT_LOG_LEVEL
  1036. CELERYBEAT_LOG_LEVEL
  1037. ~~~~~~~~~~~~~~~~~~~~
  1038. .. deprecated:: 2.4
  1039. This option is deprecated and is scheduled for removal in version 3.0.
  1040. Please use the :option:`--loglevel` argument instead.
  1041. Logging level. Can be any of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1042. :const:`ERROR`, or :const:`CRITICAL`.
  1043. Can also be set via the :option:`--loglevel` argument to
  1044. :mod:`~celery.bin.celerybeat`.
  1045. See the :mod:`logging` module for more information.
  1046. .. setting:: CELERYMON_LOG_FILE
  1047. CELERYMON_LOG_FILE
  1048. ~~~~~~~~~~~~~~~~~~
  1049. .. deprecated:: 2.4
  1050. This option is deprecated and is scheduled for removal in version 3.0.
  1051. Please use the :option:`--logfile` argument instead.
  1052. The default file name to log messages to. Can be overridden using
  1053. the :option:`--logfile` argument to `celerymon`.
  1054. The default is :const:`None` (`stderr`)
  1055. .. setting:: CELERYMON_LOG_LEVEL
  1056. CELERYMON_LOG_LEVEL
  1057. ~~~~~~~~~~~~~~~~~~~
  1058. .. deprecated:: 2.4
  1059. This option is deprecated and is scheduled for removal in version 3.0.
  1060. Please use the :option:`--loglevel` argument instead.
  1061. Logging level. Can be any of :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
  1062. :const:`ERROR`, or :const:`CRITICAL`.
  1063. See the :mod:`logging` module for more information.