File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import os
22from 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+
425os .environ .setdefault ('DJANGO_SETTINGS_MODULE' , 'api.settings.production' )
526app = Celery ('drycc' )
6- app .config_from_object ('django.conf:settings' , namespace = 'CELERY' )
27+ app .config_from_object (Config )
728app .conf .update (
829 task_routes = {
930 'api.tasks.retrieve_resource' : {'queue' : 'priority.high' },
Original file line number Diff line number Diff line change 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
491473DRYCC_INFLUXDB_URL = os .environ .get ('DRYCC_INFLUXDB_URL' , 'http://localhost:8086' )
492474DRYCC_INFLUXDB_BUCKET = os .environ .get ('DRYCC_INFLUXDB_BUCKET' , 'drycc' )
You can’t perform that action at this time.
0 commit comments