configuration.rst 39 KB

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