configuration.rst 38 KB

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