Commit 9eabdec5d3c70171721450a6b5d61d5c5870de42

Authored by Etienne Pallier
1 parent 647a6c47
Exists in dev

NEW PYROS TECHNICAL DOCUMENT (in docs/)

devices_channel/src_device/client/client_channel_serial.py
... ... @@ -21,7 +21,7 @@ class ClientChannelSerial(ClientChannel):
21 21 buf = 1024
22 22  
23 23  
24   - def __init__(self, server_host:str="localhost", server_port:int=11110, buffer_size=1024, DEBUG=False):
  24 + def __init__(self, server_host:str="localhost", server_port:int=11110, buffer_size=1024, DEBUG:bool=False):
25 25 '''
26 26 :param server_host: server IP or hostname
27 27 :param server_port: server port
... ...
doc/PyROS software.docx deleted
No preview for this file type
doc/PyROS software.pdf deleted
No preview for this file type
doc/PyROS_software.docx 0 โ†’ 100644
No preview for this file type
doc/PyROS_software.odt 0 โ†’ 100644
No preview for this file type
doc/PyROS_software.pdf 0 โ†’ 100644
No preview for this file type
src/majordome/start_agent_majordome_from_test.py deleted
... ... @@ -1,26 +0,0 @@
1   -#!/usr/bin/env python
2   -
3   -import os
4   -import sys
5   -
6   -# DJANGO setup
7   -#sys.path.append('/PROJECTS/GFT/SOFT/PYROS_SOFT/PYROS201802')
8   -sys.path.append('..')
9   -#print("file is", __file__)
10   -mypath = os.getcwd()
11   -
12   -# Go into src/
13   -##os.chdir('..')
14   -#print("Current directory : " + str(os.getcwd()))
15   -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.pyros.settings")
16   -#os.environ['SECRET_KEY'] = 'abc'
17   -#os.environ['ENVIRONMENT'] = 'production'
18   -import django
19   -django.setup()
20   -
21   -# MONITORING AGENT setup
22   -agent="majordome"
23   -
24   -if agent=="majordome":
25   - from majordome.tasks import Majordome
26   - Majordome().run()
src/pyros/test_settings_NOTUSED.py deleted
... ... @@ -1,290 +0,0 @@
1   -""" OBSOLETE FILE """
2   -"""
3   -Django settings for pyros project.
4   -
5   -Generated by 'django-admin startproject' using Django 1.9.4.
6   -
7   -For more information on this file, see
8   -https://docs.djangoproject.com/en/1.9/topics/settings/
9   -
10   -For the full list of settings and their values, see
11   -https://docs.djangoproject.com/en/1.9/ref/settings/
12   -"""
13   -
14   -# Dictionary containing all the versions for the different modules
15   -# IMPORTANT : I must be updated at every commit !
16   -
17   -MODULES_VERSIONS = {
18   - "Alert Manager" : "0.2.4",
19   - "Analyzer" : "0.1.2",
20   - "Dashboard" : "0.1.1",
21   - "Majordome" : "0.1.4",
22   - "Monitoring" : "0.1.3",
23   - "Observation Manager" : "0.1.3",
24   - "Routine Manager" : "0.1.2",
25   - "Scheduler" : "0.1.2",
26   - "User Manager" : "0.1.1",
27   - "Device" : "0.1.1"
28   -}
29   -
30   -# Set MYSQL to False if you want to use SQLITE
31   -# This line MUST NOT be changed at all except from changing True/False
32   -# (or install_requirements script will become invalid)
33   -MYSQL = True
34   -
35   -# YOU MUST CHANGE THIS VALUE IN PYROSRUN.SH TOO
36   -TEST_PORT = 8001
37   -# YOU MUST CHANGE THIS VALUE IN PYROSRUN.SH TOO
38   -
39   -
40   -import os
41   -
42   -# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
43   -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
44   -
45   -
46   -# Quick-start development settings - unsuitable for production
47   -# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
48   -
49   -# SECURITY WARNING: keep the secret key used in production secret!
50   -SECRET_KEY = '0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23'
51   -
52   -# SECURITY WARNING: don't run with debug turned on in production!
53   -DEBUG = True
54   -
55   -ALLOWED_HOSTS = ['localhost']
56   -
57   -
58   -# Application definition
59   -
60   -INSTALLED_APPS = [
61   - 'django.contrib.admin',
62   - 'django.contrib.auth',
63   - 'django.contrib.contenttypes',
64   - 'django.contrib.sessions',
65   - 'django.contrib.messages',
66   - 'django.contrib.staticfiles',
67   -
68   - # for using "./manage.py graph_models" with graphviz:
69   - # (https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#django-extensions-and-graphviz-useful-for-generating-an-image-of-all-the-models-and-their-relationships)
70   - 'django_extensions',
71   - 'test_without_migrations',
72   - 'bootstrap3',
73   - 'dashboard',
74   - 'scheduler',
75   - 'common',
76   - 'alert_manager',
77   - 'analyzer',
78   - 'majordome',
79   - 'monitoring',
80   - 'observation_manager',
81   - 'routine_manager',
82   - 'user_manager',
83   - 'devices'
84   -]
85   -
86   -MIDDLEWARE_CLASSES = [
87   - 'django.middleware.security.SecurityMiddleware',
88   - 'django.contrib.sessions.middleware.SessionMiddleware',
89   - 'django.middleware.common.CommonMiddleware',
90   - 'django.middleware.csrf.CsrfViewMiddleware',
91   - 'django.contrib.auth.middleware.AuthenticationMiddleware',
92   - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
93   - 'django.contrib.messages.middleware.MessageMiddleware',
94   - 'django.middleware.clickjacking.XFrameOptionsMiddleware',
95   -]
96   -
97   -ROOT_URLCONF = 'pyros.urls'
98   -
99   -TEMPLATES = [
100   - {
101   - 'BACKEND': 'django.template.backends.django.DjangoTemplates',
102   - 'DIRS': ['misc/templates'],
103   - 'APP_DIRS': True,
104   - 'OPTIONS': {
105   - 'context_processors': [
106   - 'django.template.context_processors.debug',
107   - 'django.template.context_processors.request',
108   - 'django.contrib.auth.context_processors.auth',
109   - 'django.contrib.messages.context_processors.messages',
110   - ],
111   - },
112   - },
113   -]
114   -
115   -WSGI_APPLICATION = 'pyros.wsgi.application'
116   -
117   -FIXTURE_DIRS = (
118   - 'misc/fixtures/',
119   -)
120   -
121   -LOGIN_URL = "/"
122   -
123   -# Database
124   -# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
125   -
126   -# EP modif
127   -
128   -CELERY_TEST = False
129   -
130   -if not CELERY_TEST:
131   - if not MYSQL:
132   - DATABASES = {
133   - 'default': {
134   - 'ENGINE': 'django.db.backends.sqlite3',
135   - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
136   - }
137   - }
138   - else:
139   - DATABASES = {
140   - 'default': {
141   - 'ENGINE': 'django.db.backends.mysql',
142   - 'NAME': 'test_pyros',
143   - 'USER': 'pyros',
144   - 'PASSWORD': 'DjangoPyros',
145   - }
146   - }
147   -else:
148   - DATABASES = {
149   - 'default': {
150   - 'ENGINE': 'django.db.backends.sqlite3',
151   - 'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3'),
152   - 'TEST': {
153   - 'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3'),
154   - },
155   - }
156   - }
157   -
158   -
159   -# Password validation
160   -# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
161   -
162   -AUTH_PASSWORD_VALIDATORS = [
163   - {
164   - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
165   - },
166   - {
167   - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
168   - },
169   - {
170   - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
171   - },
172   - {
173   - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
174   - },
175   -]
176   -
177   -
178   -# Internationalization
179   -# https://docs.djangoproject.com/en/1.9/topics/i18n/
180   -
181   -#LANGUAGE_CODE = 'en-us'
182   -LANGUAGE_CODE = 'fr-FR'
183   -
184   -#TIME_ZONE = 'UTC'
185   -TIME_ZONE = 'Europe/Paris'
186   -
187   -USE_I18N = True
188   -
189   -USE_L10N = True
190   -
191   -USE_TZ = True
192   -
193   -
194   -# To find the media files {{ MEDIA_URL }}
195   -MEDIA_URL = '/public/static/media/'
196   -
197   -
198   -# To find the static files in the app/static/ap/... folders
199   -STATIC_URL = '/public/static/'
200   -
201   -# To find the static files in src/static/. Any local directory can be added to this list.
202   -STATICFILES_DIRS = (
203   - os.path.join(BASE_DIR, "misc", "static"),
204   - )
205   -
206   -# Used for deployment (DEBUG = False). Need to run "python manage.py collectstatic" to fill it.
207   -STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'public', 'static')
208   -
209   -
210   -# EP added
211   -if not DEBUG:
212   - '''
213   - CACHES = {
214   - 'default': {
215   - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
216   - 'LOCATION': '127.0.0.1:11211',
217   - }
218   - }
219   - '''
220   - CACHES = {
221   - 'default': {
222   - 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
223   - 'LOCATION': '/var/tmp/django_cache',
224   - }
225   - }
226   -
227   -else:
228   - CACHES = {
229   - 'default': {
230   - 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
231   - }
232   - }
233   -
234   -# from django.core.cache import cache
235   -# cache.clear()
236   -
237   -# CELERY CONFIG
238   -
239   -# CELERY_RESULT_BACKEND = 'rpc://'
240   -CELERY_RESULT_BACKEND = 'amqp'
241   -
242   -CELERY_ACCEPT_CONTENT = ['json']
243   -CELERY_TASK_SERIALIZER = 'json'
244   -CELERY_RESULT_SERIALIZER = 'json'
245   -
246   -CELERY_IMPORTS = (
247   - "alert_manager.tasks",
248   - "analyzer.tasks",
249   - "majordome.tasks",
250   - "monitoring.tasks",
251   - "observation_manager.tasks",
252   - "scheduler.tasks",
253   -)
254   -
255   -# This config allows only 1 process / queue. We replace it by the -c option at celery workers creation.
256   -# CELERYD_CONCURRENCY = 1
257   -
258   -''' Following config is needed for manual purge '''
259   -CELERY_ACKS_LATE = False
260   -CELERYD_PREFETCH_MULTIPLIER = 1
261   -
262   -CELERY_QUEUES = {
263   - "alert_listener_q": {"exchange": "alert_listener_q", "routing_key": "alert_listener_q"},
264   - "analysis_q": {"exchange": "analysis_q", "routing_key": "analysis_q"},
265   - "system_status_q": {"exchange": "system_status_q", "routing_key": "system_status_q"},
266   - "change_obs_conditions_q": {"exchange": "change_obs_conditions_q", "routing_key": "change_obs_conditions_q"},
267   - "monitoring_q": {"exchange": "monitoring_q", "routing_key": "monitoring_q"},
268   - "scheduling_q": {"exchange": "scheduling_q", "routing_key": "scheduling_q"},
269   - "execute_sequence_q": {"exchange": "execute_sequence_q", "routing_key": "execute_sequence_q"},
270   - "execute_plan_vis_q": {"exchange": "execute_plan_vis_q", "routing_key": "execute_plan_vis_q"},
271   - "execute_plan_nir_q": {"exchange": "execute_plan_nir_q", "routing_key": "execute_plan_nir_q"},
272   - "create_calibrations_q": {"exchange": "create_calibrations_q", "routing_key": "create_calibrations_q"},
273   -}
274   -
275   -CELERY_ROUTES = {
276   - "alert_manager.tasks.alert_listener": {"queue": "alert_listener_q"},
277   - "analyzer.tasks.analysis": {"queue": "analysis_q"},
278   - "majordome.tasks.execute_sequence": {"queue": "execute_sequence_q"},
279   - "majordome.tasks.system_pause": {"queue": "system_status_q"},
280   - "majordome.tasks.system_restart": {"queue": "system_status_q"},
281   - "majordome.tasks.change_obs_conditions": {"queue": "change_obs_conditions_q"},
282   - "monitoring.tasks.monitoring": {"queue": "monitoring_q"},
283   - "observation_manager.tasks.execute_plan_vis": {"queue": "execute_plan_vis_q"},
284   - "observation_manager.tasks.execute_plan_nir": {"queue": "execute_plan_nir_q"},
285   - "observation_manager.tasks.create_calibrations": {"queue": "create_calibrations_q"},
286   - "scheduler.tasks.scheduling": {"queue": "scheduling_q"},
287   -}
288   -
289   -''' Removes pickle warning '''
290   -CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']