From a190892cd1c3d27f2dc94a62c1a50e8960ba3948 Mon Sep 17 00:00:00 2001 From: haribo Date: Tue, 5 Jul 2016 16:32:45 +0200 Subject: [PATCH] Date: 05/07/2016 By: Paul Carensac Version: 0.10.1 Save soft versions at start (moved in monitoring) Issues (closed): https://projects.irap.omp.eu/issues/3941 Major current version (0.9): https://projects.irap.omp.eu/versions/120 --- README.md | 8 ++++---- src/analyzer/calibrations/dark.fits | 0 src/analyzer/calibrations/dark.fitz | 0 src/analyzer/calibrations/flat.fits | 0 src/analyzer/calibrations/flat.fitz | 0 src/monitoring/tasks.py | 15 ++++++++++++++- src/pyros/__init__.py | 5 +++++ src/pyros/settings.py | 2 +- src/pyrosapp/apps.py | 14 +------------- src/scripts/start_celery_workers.sh | 2 +- 10 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 src/analyzer/calibrations/dark.fits delete mode 100644 src/analyzer/calibrations/dark.fitz create mode 100644 src/analyzer/calibrations/flat.fits delete mode 100644 src/analyzer/calibrations/flat.fitz diff --git a/README.md b/README.md index c49915f..876e87c 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,10 @@ CURRENT VERSION Date: 05/07/2016 By: Paul Carensac -Version: 0.9.2 -Multiple analyses at the same time -Issues (closed): https://projects.irap.omp.eu/issues/3932 -Major current version (0.9): https://projects.irap.omp.eu/versions/119 +Version: 0.10.1 +Save soft versions at start (moved in monitoring) +Issues (closed): https://projects.irap.omp.eu/issues/3941 +Major current version (0.9): https://projects.irap.omp.eu/versions/120 ROADMAP: https://projects.irap.omp.eu/projects/pyros/roadmap diff --git a/src/analyzer/calibrations/dark.fits b/src/analyzer/calibrations/dark.fits new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/analyzer/calibrations/dark.fits diff --git a/src/analyzer/calibrations/dark.fitz b/src/analyzer/calibrations/dark.fitz deleted file mode 100644 index e69de29..0000000 --- a/src/analyzer/calibrations/dark.fitz +++ /dev/null diff --git a/src/analyzer/calibrations/flat.fits b/src/analyzer/calibrations/flat.fits new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/analyzer/calibrations/flat.fits diff --git a/src/analyzer/calibrations/flat.fitz b/src/analyzer/calibrations/flat.fitz deleted file mode 100644 index e69de29..0000000 --- a/src/analyzer/calibrations/flat.fitz +++ /dev/null diff --git a/src/monitoring/tasks.py b/src/monitoring/tasks.py index d1ca119..617d895 100644 --- a/src/monitoring/tasks.py +++ b/src/monitoring/tasks.py @@ -1,5 +1,6 @@ from __future__ import absolute_import - +from django.conf import settings +from pyrosapp.models import * from celery.task import Task import time @@ -7,5 +8,17 @@ import time class monitoring(Task): def run(self): + self.update_software_versions() + time.sleep(5) print("monitoring") + + def update_software_versions(self): + versions = settings.MODULES_VERSIONS + + for module, version in versions.items(): + same_module_versions = Version.objects.filter(module_name=module) + if same_module_versions.count() == 0: + Version.objects.create(module_name=module, version=version) + elif same_module_versions.order_by("-created")[0].version != version: + Version.objects.create(module_name=module, version=version) diff --git a/src/pyros/__init__.py b/src/pyros/__init__.py index 4bc94d1..f8b8c3f 100644 --- a/src/pyros/__init__.py +++ b/src/pyros/__init__.py @@ -8,5 +8,10 @@ from celery.signals import worker_ready @worker_ready.connect def start_permanent_tasks(signal, sender): import alert_manager.tasks + import monitoring.tasks + if sender.hostname == "pyros@alert_listener": alert_manager.tasks.alert_listener.delay() + + if sender.hostname == "pyros@monitoring": + monitoring.tasks.monitoring.delay() diff --git a/src/pyros/settings.py b/src/pyros/settings.py index 2e051a3..e04f635 100644 --- a/src/pyros/settings.py +++ b/src/pyros/settings.py @@ -16,7 +16,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/ MODULES_VERSIONS = { "Alert Manager" : "0.1", "Analyzer" : "0.2", - "Dashboard" : "0.1", + "Dashboard" : "0.2", "Majordome" : "0.3", "Monitoring" : "0.1", "Observation Manager" : "0.2", diff --git a/src/pyrosapp/apps.py b/src/pyrosapp/apps.py index 17f77e7..f906b3f 100644 --- a/src/pyrosapp/apps.py +++ b/src/pyrosapp/apps.py @@ -1,17 +1,5 @@ from django.apps import AppConfig -from django.conf import settings + class PyrosappConfig(AppConfig): name = 'pyrosapp' - - def ready(self): - from pyrosapp.models import Version - AppConfig.ready(self) - versions = settings.MODULES_VERSIONS - - for module, version in versions.items(): - same_module_versions = Version.objects.filter(module_name=module) - if same_module_versions.count() == 0: - Version.objects.create(module_name=module, version=version) - elif same_module_versions.order_by("-created")[0].version != version: - Version.objects.create(module_name=module, version=version) diff --git a/src/scripts/start_celery_workers.sh b/src/scripts/start_celery_workers.sh index abf4124..1f9f29a 100755 --- a/src/scripts/start_celery_workers.sh +++ b/src/scripts/start_celery_workers.sh @@ -14,4 +14,4 @@ celery worker -A pyros -Q execute_plan_nir_q --purge -n pyros@execute_plan_nir - celery worker -A pyros -Q analysis_q --purge -n pyros@analysis -c 5 & celery worker -A pyros -Q system_status_q --purge -n pyros@system_status -c 1 & celery worker -A pyros -Q change_obs_conditions_q --purge -n pyros@change_obs_conditions -c 1 & -# celery worker -A pyros -Q monitoring_q -n pyros@monitoring -c 1 & +celery worker -A pyros -Q monitoring_q -n pyros@monitoring -c 1 & -- libgit2 0.21.2