Commit 6433a8c7 authored by 段英荣's avatar 段英荣

modify

parent 7199ac89
# coding=utf-8
from __future__ import unicode_literals, print_function, absolute_import
import itertools
from django.conf import settings
class CeleryTaskRouter(object):
queue_task_map = {
"gaia-dbmw":{
'injection.data_sync.tasks.write_to_es',
}
}
# Map[TaskName, QueueName]
task_queue_map = dict(itertools.chain.from_iterable(
[(task, queue) for task in task_list]
for (queue, task_list) in queue_task_map.items()
))
def route_for_task(self, task, args=None, kwargs=None):
"""
if settings.DEBUG:
return None
if task.startswith("statistic") or task.startswith("api.tasks.export_excel_task"):
return "slow"
"""
queue_name_or_none = self.task_queue_map.get(task)
return queue_name_or_none
\ No newline at end of file
...@@ -30,6 +30,9 @@ ALLOWED_HOSTS = [] ...@@ -30,6 +30,9 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
BROKER_URL = "redis://127.0.0.1:6379/0"
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_ROUTES = ['physical.celery_task_router.CeleryTaskRouter']
INSTALLED_APPS = [ INSTALLED_APPS = [
'django.contrib.admin', 'django.contrib.admin',
...@@ -40,6 +43,7 @@ INSTALLED_APPS = [ ...@@ -40,6 +43,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'trans2es', 'trans2es',
'search', 'search',
'injection.data_sync'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment