Skip to content

Commit

Permalink
Merge pull request teamhephy#60 from jianxiaoguo/main
Browse files Browse the repository at this point in the history
fix(controller): upgrade celery config
  • Loading branch information
duanhongyi authored Sep 6, 2021
2 parents fd83d06 + 1cd71d3 commit 78b65e3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
23 changes: 22 additions & 1 deletion rootfs/api/settings/celery.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
import os
from celery import Celery, platforms


class Config:
# Celery Configuration Options
timezone = "Asia/Shanghai"
enable_utc = True
task_serializer = 'pickle'
accept_content = frozenset([
'application/data',
'application/text',
'application/json',
'application/x-python-serialize',
])
task_track_started = True
task_time_limit = 30 * 60
worker_max_tasks_per_child = 200
result_expires = 24 * 60 * 60
broker_url = os.environ.get('DRYCC_RABBITMQ_URL', 'amqp://guest:[email protected]:5672/') # noqa
cache_backend = 'django-cache'
task_default_queue = 'priority.middle'


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings.production')
app = Celery('drycc')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.config_from_object(Config)
app.conf.update(
task_routes={
'api.tasks.retrieve_resource': {'queue': 'priority.high'},
Expand Down
18 changes: 0 additions & 18 deletions rootfs/api/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,24 +469,6 @@
}
}

# Celery Configuration Options
timezone = "Asia/Shanghai"
enable_utc = True
task_serializer = 'pickle'
accept_content = frozenset([
'application/data',
'application/text',
'application/json',
'application/x-python-serialize',
])
task_track_started = True
task_time_limit = 30 * 60
worker_max_tasks_per_child = 200
result_expires = 24 * 60 * 60
broker_url = os.environ.get('DRYCC_RABBITMQ_URL', 'amqp://guest:[email protected]:5672/') # noqa
cache_backend = 'django-cache'
task_default_queue = 'priority.middle'

# Influxdb Configuration Options
DRYCC_INFLUXDB_URL = os.environ.get('DRYCC_INFLUXDB_URL', 'http://localhost:8086')
DRYCC_INFLUXDB_BUCKET = os.environ.get('DRYCC_INFLUXDB_BUCKET', 'drycc')
Expand Down

0 comments on commit 78b65e3

Please sign in to comment.