source file: /opt/devel/celery/celery/conf.py
file stats: 43 lines, 43 executed: 100.0% covered
1. from django.conf import settings
2. import logging
3.
4. # The default AMQP exchange key.
5. DEFAULT_AMQP_EXCHANGE = "celery"
6.
7. # The default AMQP routing key
8. DEFAULT_AMQP_ROUTING_KEY = "celery"
9.
10. # The default AMQP consumer queue.
11. DEFAULT_AMQP_CONSUMER_QUEUE = "celery"
12.
13. # If True, task meta information (like is_done) is saved to the database
14. # instead of using the Django cache framework.
15. DEFAULT_TASK_META_USE_DB = False
16.
17. # The number of processes to work simultaneously at processing the queue.
18. DEFAULT_DAEMON_CONCURRENCY = 10
19.
20. # If the queue is empty, this is the time *in seconds* the daemon sleeps
21. # until it wakes up to check if there's any new messages on the queue.
22. DEFAULT_QUEUE_WAKEUP_AFTER = 0.3
23.
24. # As long as the queue is empty, the daemon logs a "Queue is empty" message
25. # every ``EMPTY_MSG_EMIT_EVERY`` *seconds*.
26. DEFAULT_EMPTY_MSG_EMIT_EVERY = 5
27.
28. DEFAULT_DAEMON_PID_FILE = "celeryd.pid"
29.
30. # The format we log messages in.
31. DEFAULT_LOG_FMT = '[%(asctime)s: %(levelname)s/%(processName)s] %(message)s'
32.
33. # Default log level [DEBUG|INFO|WARNING|ERROR|CRITICAL|FATAL]
34. DEFAULT_DAEMON_LOG_LEVEL = "INFO"
35.
36. # Default log file
37. DEFAULT_DAEMON_LOG_FILE = "celeryd.log"
38.
39. # Table of loglevels to constants for use in settings.py.
40. LOG_LEVELS = {
41. "DEBUG": logging.DEBUG,
42. "INFO": logging.INFO,
43. "WARNING": logging.WARNING,
44. "WARN": logging.WARNING,
45. "ERROR": logging.ERROR,
46. "CRITICAL": logging.CRITICAL,
47. "FATAL": logging.FATAL,
48. }
49.
50.
51. TASK_META_USE_DB = getattr(settings, "CELERY_TASK_META_USE_DB",
52. DEFAULT_TASK_META_USE_DB)
53. LOG_FORMAT = getattr(settings, "CELERYD_DAEMON_LOG_FORMAT",
54. DEFAULT_LOG_FMT)
55. DAEMON_LOG_FILE = getattr(settings, "CELERYD_LOG_FILE",
56. DEFAULT_DAEMON_LOG_FILE)
57. DAEMON_LOG_LEVEL = LOG_LEVELS[getattr(settings, "CELERYD_DAEMON_LOG_LEVEL",
58. DEFAULT_DAEMON_LOG_LEVEL).upper()]
59.
60. QUEUE_WAKEUP_AFTER = getattr(settings, "CELERYD_QUEUE_WAKEUP_AFTER",
61. DEFAULT_QUEUE_WAKEUP_AFTER)
62. EMPTY_MSG_EMIT_EVERY = getattr(settings, "CELERYD_EMPTY_MSG_EMIT_EVERY",
63. DEFAULT_EMPTY_MSG_EMIT_EVERY)
64. DAEMON_PID_FILE = getattr(settings, "CELERYD_PID_FILE",
65. DEFAULT_DAEMON_PID_FILE)
66. DAEMON_CONCURRENCY = getattr(settings, "CELERYD_CONCURRENCY",
67. DEFAULT_DAEMON_CONCURRENCY)
68.
69. AMQP_EXCHANGE = getattr(settings, "CELERY_AMQP_EXCHANGE",
70. DEFAULT_AMQP_EXCHANGE)
71. AMQP_ROUTING_KEY = getattr(settings, "CELERY_AMQP_ROUTING_KEY",
72. DEFAULT_AMQP_ROUTING_KEY)
73. AMQP_CONSUMER_QUEUE = getattr(settings, "CELERY_AMQP_CONSUMER_QUEUE",
74. DEFAULT_AMQP_CONSUMER_QUEUE)