Commit a190892cd1c3d27f2dc94a62c1a50e8960ba3948

Authored by haribo
1 parent 288601ca
Exists in master and in 1 other branch dev

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
... ... @@ -62,10 +62,10 @@ CURRENT VERSION
62 62  
63 63 Date: 05/07/2016
64 64 By: Paul Carensac
65   -Version: 0.9.2
66   -Multiple analyses at the same time
67   -Issues (closed): https://projects.irap.omp.eu/issues/3932
68   -Major current version (0.9): https://projects.irap.omp.eu/versions/119
  65 +Version: 0.10.1
  66 +Save soft versions at start (moved in monitoring)
  67 +Issues (closed): https://projects.irap.omp.eu/issues/3941
  68 +Major current version (0.9): https://projects.irap.omp.eu/versions/120
69 69  
70 70 ROADMAP: https://projects.irap.omp.eu/projects/pyros/roadmap
71 71  
... ...
src/analyzer/calibrations/dark.fitz renamed to src/analyzer/calibrations/dark.fits
src/analyzer/calibrations/flat.fitz renamed to src/analyzer/calibrations/flat.fits
src/monitoring/tasks.py
1 1 from __future__ import absolute_import
2   -
  2 +from django.conf import settings
  3 +from pyrosapp.models import *
3 4 from celery.task import Task
4 5  
5 6 import time
... ... @@ -7,5 +8,17 @@ import time
7 8 class monitoring(Task):
8 9  
9 10 def run(self):
  11 + self.update_software_versions()
  12 +
10 13 time.sleep(5)
11 14 print("monitoring")
  15 +
  16 + def update_software_versions(self):
  17 + versions = settings.MODULES_VERSIONS
  18 +
  19 + for module, version in versions.items():
  20 + same_module_versions = Version.objects.filter(module_name=module)
  21 + if same_module_versions.count() == 0:
  22 + Version.objects.create(module_name=module, version=version)
  23 + elif same_module_versions.order_by("-created")[0].version != version:
  24 + Version.objects.create(module_name=module, version=version)
... ...
src/pyros/__init__.py
... ... @@ -8,5 +8,10 @@ from celery.signals import worker_ready
8 8 @worker_ready.connect
9 9 def start_permanent_tasks(signal, sender):
10 10 import alert_manager.tasks
  11 + import monitoring.tasks
  12 +
11 13 if sender.hostname == "pyros@alert_listener":
12 14 alert_manager.tasks.alert_listener.delay()
  15 +
  16 + if sender.hostname == "pyros@monitoring":
  17 + monitoring.tasks.monitoring.delay()
... ...
src/pyros/settings.py
... ... @@ -16,7 +16,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
16 16 MODULES_VERSIONS = {
17 17 "Alert Manager" : "0.1",
18 18 "Analyzer" : "0.2",
19   - "Dashboard" : "0.1",
  19 + "Dashboard" : "0.2",
20 20 "Majordome" : "0.3",
21 21 "Monitoring" : "0.1",
22 22 "Observation Manager" : "0.2",
... ...
src/pyrosapp/apps.py
1 1 from django.apps import AppConfig
2   -from django.conf import settings
  2 +
3 3  
4 4 class PyrosappConfig(AppConfig):
5 5 name = 'pyrosapp'
6   -
7   - def ready(self):
8   - from pyrosapp.models import Version
9   - AppConfig.ready(self)
10   - versions = settings.MODULES_VERSIONS
11   -
12   - for module, version in versions.items():
13   - same_module_versions = Version.objects.filter(module_name=module)
14   - if same_module_versions.count() == 0:
15   - Version.objects.create(module_name=module, version=version)
16   - elif same_module_versions.order_by("-created")[0].version != version:
17   - Version.objects.create(module_name=module, version=version)
... ...
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 -
14 14 celery worker -A pyros -Q analysis_q --purge -n pyros@analysis -c 5 &
15 15 celery worker -A pyros -Q system_status_q --purge -n pyros@system_status -c 1 &
16 16 celery worker -A pyros -Q change_obs_conditions_q --purge -n pyros@change_obs_conditions -c 1 &
17   -# celery worker -A pyros -Q monitoring_q -n pyros@monitoring -c 1 &
  17 +celery worker -A pyros -Q monitoring_q -n pyros@monitoring -c 1 &
... ...