From 23cf95a75298e768b6b1397b3076834084e666cd Mon Sep 17 00:00:00 2001 From: zakhy Date: Wed, 24 Jul 2024 09:28:37 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=20=D0=BA=D0=B0=D0=B6=D0=B4=D1=83=D1=8E=20?= =?UTF-8?q?=D0=BC=D0=B8=D0=BD=D1=83=D1=82=D1=83,=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20=D1=84=D0=B8=D0=BA=D1=81=D1=82?= =?UTF-8?q?=D1=83=D1=80=D1=83=20=D1=81=20=D0=BF=D0=BE=D0=B7=D0=B8=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=D0=BC=D0=B8,=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=BE=20=D0=B7=D0=B0=D0=BF=D1=80=D0=B0=D1=88=D0=B8=D0=B2?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=D1=8B=D1=85=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B5=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/main/tasks.py | 5 +++-- positions.json | 2 +- repcofkk/celery.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/main/tasks.py b/apps/main/tasks.py index 74adba0..ecda3fe 100644 --- a/apps/main/tasks.py +++ b/apps/main/tasks.py @@ -68,6 +68,7 @@ def create_scales_control_data(): print(f"Task: selected data at {datetime.now()}") write_scales_data(scales_data) print(f"Task performed at {datetime.now()}") + return 0 def get_scales_data() -> list: @@ -84,7 +85,7 @@ def get_scales_data() -> list: SELECT "Name", "Values", "Date", "Check" FROM public.vesi ORDER BY id DESC - LIMIT 20000; + LIMIT 3000; """) data = cursor.fetchall() @@ -102,7 +103,7 @@ def write_scales_data(data: list): port="5432" ) try: - with postgres_conn.cursor() as cursor: + with postgres_conn.cursor() as cursor: # TODO при настройке ОПС на запись в БД - убрать первое условие for row in data: name, value, date, check = row cursor.execute(""" diff --git a/positions.json b/positions.json index 90a505e..68118c0 100644 --- a/positions.json +++ b/positions.json @@ -33,7 +33,7 @@ "fields": { "title": "Поз. 22", "tag": "SIEMENSPLC.AZG01.ReportProdDB.ProdPos22", - "aver_smena_tag": "SIEMENSPLC.AZG01.ReportProdDB.Pos2AverSmena", + "aver_smena_tag": "SIEMENSPLC.AZG01.ReportProdDB.Pos22AverSmena", "aver_pred_smena_tag": "SIEMENSPLC.AZG01.ReportProdDB.Pos22AverPredSmena", "smena_tag": "SIEMENSPLC.AZG01.ReportProdDB.ProdPos22.Smena", "pred_smena_tag": "SIEMENSPLC.AZG01.ReportProdDB.ProdPos22.PredSmena", diff --git a/repcofkk/celery.py b/repcofkk/celery.py index 24fab00..6b4b7d9 100644 --- a/repcofkk/celery.py +++ b/repcofkk/celery.py @@ -17,10 +17,10 @@ app.autodiscover_tasks() app.conf.beat_schedule = { 'worktime': { 'task': 'apps.main.tasks.create_worktime_data', - 'schedule': crontab(minute='*/1'), # выполняет каждую минуту + 'schedule': crontab(minute='*/1'), }, 'scales_control': { 'task': 'apps.main.tasks.create_scales_control_data', - 'schedule': crontab(minute='*/2'), # выполняет каждые 5 минут + 'schedule': crontab(minute='*/1'), }, }