configuration.rst 39 KB

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