-
Notifications
You must be signed in to change notification settings - Fork 1
/
celery_setting.py.sample
86 lines (72 loc) · 2.77 KB
/
celery_setting.py.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ASYNC_SIGNALS = True
RABBITMQ_SIGNALS_BROKER_URL = 'amqp://localhost:5672'
REDIS_SIGNALS_BROKER_URL = 'redis://localhost:6379/0'
LOCAL_SIGNALS_BROKER_URL = 'memory://'
if ASYNC_SIGNALS:
_BROKER_URL = os.environ.get('BROKER_URL', RABBITMQ_SIGNALS_BROKER_URL)
# _BROKER_URL = = os.environ.get('BROKER_URL', REDIS_SIGNALS_BROKER_URL)
CELERY_RESULT_BACKEND = _BROKER_URL
else:
_BROKER_URL = LOCAL_SIGNALS_BROKER_URL
BROKER_URL = _BROKER_URL
CELERY_RESULT_PERSISTENT = False
# Allow to recover from any unknown crash.
CELERY_ACKS_LATE = True
# Set this to False in order to run async
CELERY_TASK_ALWAYS_EAGER = False if ASYNC_SIGNALS else True
CELERY_TASK_IGNORE_RESULT = False
# I use these to debug kombu crashes; we get a more informative message.
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_CREATE_MISSING_QUEUES = True
CELERY_TASK_RESULT_EXPIRES = 43200
# Sometimes, Ask asks us to enable this to debug issues.
# BTW, it will save some CPU cycles.
CELERY_DISABLE_RATE_LIMITS = False
CELERY_SEND_TASK_EVENTS = True
CELERY_WORKER_DISABLE_RATE_LIMITS = False
CELERY_WORKER_SEND_TASK_EVENTS = True
GEONODE_EXCHANGE = Exchange("default", type="direct", durable=True)
GEOSERVER_EXCHANGE = Exchange("geonode", type="topic", durable=False)
CELERY_TASK_QUEUES = (
Queue('default', GEONODE_EXCHANGE, routing_key='default'),
Queue('geonode', GEONODE_EXCHANGE, routing_key='geonode'),
Queue('update', GEONODE_EXCHANGE, routing_key='update'),
Queue('cleanup', GEONODE_EXCHANGE, routing_key='cleanup'),
Queue('email', GEONODE_EXCHANGE, routing_key='email'),
)
CELERY_TASK_QUEUES += (
Queue("broadcast", GEOSERVER_EXCHANGE, routing_key="#"),
Queue("email.events", GEOSERVER_EXCHANGE, routing_key="email"),
Queue("all.geoserver", GEOSERVER_EXCHANGE, routing_key="geoserver.#"),
Queue(
"geoserver.catalog",
GEOSERVER_EXCHANGE,
routing_key="geoserver.catalog"),
Queue(
"geoserver.data",
GEOSERVER_EXCHANGE,
routing_key="geoserver.catalog"),
Queue(
"geoserver.events",
GEOSERVER_EXCHANGE,
routing_key="geonode.geoserver"),
Queue(
"notifications.events",
GEOSERVER_EXCHANGE,
routing_key="notifications"),
Queue(
"geonode.layer.viewer",
GEOSERVER_EXCHANGE,
routing_key="geonode.viewer"),
)
# Allow our remote workers to get tasks faster if they have a
# slow internet connection (yes Gurney, I'm thinking of you).
CELERY_MESSAGE_COMPRESSION = 'gzip'
# The default beiing 5000, we need more than this.
CELERY_MAX_CACHED_RESULTS = 32768
# NOTE: I don't know if this is compatible with upstart.
CELERYD_POOL_RESTARTS = True
CELERY_TRACK_STARTED = True
CELERY_SEND_TASK_SENT_EVENT = True