Skip to content

Commit 1cd71d3

Browse files
author
lijianguo
committed
fix(controller): upgrade celery config
1 parent fd83d06 commit 1cd71d3

2 files changed

Lines changed: 22 additions & 19 deletions

File tree

rootfs/api/settings/celery.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
import os
22
from celery import Celery, platforms
33

4+
5+
class Config:
6+
# Celery Configuration Options
7+
timezone = "Asia/Shanghai"
8+
enable_utc = True
9+
task_serializer = 'pickle'
10+
accept_content = frozenset([
11+
'application/data',
12+
'application/text',
13+
'application/json',
14+
'application/x-python-serialize',
15+
])
16+
task_track_started = True
17+
task_time_limit = 30 * 60
18+
worker_max_tasks_per_child = 200
19+
result_expires = 24 * 60 * 60
20+
broker_url = os.environ.get('DRYCC_RABBITMQ_URL', 'amqp://guest:guest@127.0.0.1:5672/') # noqa
21+
cache_backend = 'django-cache'
22+
task_default_queue = 'priority.middle'
23+
24+
425
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings.production')
526
app = Celery('drycc')
6-
app.config_from_object('django.conf:settings', namespace='CELERY')
27+
app.config_from_object(Config)
728
app.conf.update(
829
task_routes={
930
'api.tasks.retrieve_resource': {'queue': 'priority.high'},

rootfs/api/settings/production.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -469,24 +469,6 @@
469469
}
470470
}
471471

472-
# Celery Configuration Options
473-
timezone = "Asia/Shanghai"
474-
enable_utc = True
475-
task_serializer = 'pickle'
476-
accept_content = frozenset([
477-
'application/data',
478-
'application/text',
479-
'application/json',
480-
'application/x-python-serialize',
481-
])
482-
task_track_started = True
483-
task_time_limit = 30 * 60
484-
worker_max_tasks_per_child = 200
485-
result_expires = 24 * 60 * 60
486-
broker_url = os.environ.get('DRYCC_RABBITMQ_URL', 'amqp://guest:guest@127.0.0.1:5672/') # noqa
487-
cache_backend = 'django-cache'
488-
task_default_queue = 'priority.middle'
489-
490472
# Influxdb Configuration Options
491473
DRYCC_INFLUXDB_URL = os.environ.get('DRYCC_INFLUXDB_URL', 'http://localhost:8086')
492474
DRYCC_INFLUXDB_BUCKET = os.environ.get('DRYCC_INFLUXDB_BUCKET', 'drycc')

0 commit comments

Comments
 (0)