diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index a80b5011..aac00bc1 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -152,33 +152,33 @@ def cal_mpointstats(is_now=1, year=None, month=None, day=None, hour=None): # 先统计不带公式的测点 mpoints_without_formula = Mpoint.objects.filter(is_auto=True, formula='') - mpoints_without_formula_group = [] + # mpoints_without_formula_group = [] for item in mpoints_without_formula: - mpoints_without_formula_group.append(cal_mpointstat_hour.s(item.id, year, month, day, hour)) - # cal_mpointstat_hour(item.id, year, month, day, hour) + # mpoints_without_formula_group.append(cal_mpointstat_hour.s(item.id, year, month, day, hour)) + cal_mpointstat_hour(item.id, year, month, day, hour) # 再统计其他测点 mpoints_other = Mpoint.objects.filter(is_auto=True).exclude(formula='') - mpoints_other_group = [] + # mpoints_other_group = [] for item in mpoints_other: - mpoints_other_group.append(cal_mpointstat_hour.s(item.id, year, month, day, hour)) - # cal_mpointstat_hour(item.id, year, month, day, hour) + # mpoints_other_group.append(cal_mpointstat_hour.s(item.id, year, month, day, hour)) + cal_mpointstat_hour(item.id, year, month, day, hour) # 开始计算enstat mgroups = Mgroup.objects.all().order_by('sort') mgroups_group = [] for mgroup in mgroups: - mgroups_group.append(cal_enstat.s('hour_s', None, mgroup.id, year, month, day, hour, None, None, None, True, ['material', 'run_hour'])) - # cal_enstat('hour_s', None, mgroup.id, year, month, day, hour, None, None, None, True) + # mgroups_group.append(cal_enstat.s('hour_s', None, mgroup.id, year, month, day, hour, None, None, None, True, ['material', 'run_hour'])) + cal_enstat('hour_s', None, mgroup.id, year, month, day, hour, None, None, None, True) - mgroups_t = mgroups.filter(name__in=['回转窑', '水泥磨']) - mgroups_t_group = [] - for mgroup in mgroups_t: - mgroups_t_group.append(cal_enstat.s('hour_s', None, mgroup.id, year, month, day, hour, None, None, None, True, ['pcoal'])) + # mgroups_t = mgroups.filter(name__in=['回转窑', '水泥磨']) + # mgroups_t_group = [] + # for mgroup in mgroups_t: + # mgroups_t_group.append(cal_enstat.s('hour_s', None, mgroup.id, year, month, day, hour, None, None, None, True, ['pcoal'])) # 最后计算enstat2 - - task_chain = chain(group(mpoints_without_formula_group), group(mpoints_other_group), group(mgroups_group), group(mgroups_t_group), group([cal_enstat2.s(year_s=year, month_s=month)])) - task_chain.delay() + cal_enstat2(year_s=year, month_s=month) + # task_chain = chain(group(mpoints_without_formula_group), group(mpoints_other_group), group(mgroups_group), group(mgroups_t_group), group([cal_enstat2.s(year_s=year, month_s=month)])) + # task_chain.delay() @shared_task(base=CustomTask) def cal_mpointstat_manual(mpointId: str, sflogId: str, mgroupId: str, year: int, month: int, day: int, hour: int, year_s: int, month_s: int, day_s: int, next_cal=0): diff --git a/server/settings.py b/server/settings.py index ab3de955..eb0168dc 100755 --- a/server/settings.py +++ b/server/settings.py @@ -265,7 +265,7 @@ AUTHENTICATION_BACKENDS = ( CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://localhost:6379/2", + "LOCATION": "redis://127.0.0.1:6379/2", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } @@ -273,7 +273,7 @@ CACHES = { } # celery配置,celery正常运行必须安装redis -CELERY_BROKER_URL = "redis://localhost:6379/2" # 任务存储 +CELERY_BROKER_URL = "redis://127.0.0.1:6379/3" # 任务存储 CELERYD_MAX_TASKS_PER_CHILD = 100 # 每个worker最多执行100个任务就会被销毁,可防止内存泄露 CELERY_TIMEZONE = 'Asia/Shanghai' # 设置时区 CELERY_ENABLE_UTC = True # 启动时区设置