Commit 12451fdec7cfbf281418971e2bf273a6eef85913
1 parent
7f6e4bdc
Exists in
dev
Amélioration logging
- ajout quelques log debug dans AgentM - script PYROS_DOCKER_RUN démarre le serveur web et l'agentM en mode debug
Showing
4 changed files
with
19 additions
and
7 deletions
Show diff stats
CHANGELOG
1 | 1 | |
2 | 2 | |
3 | -05-01-2022 (EP) : | |
3 | +05-01-2022 (EP) : v0.3.1.2 | |
4 | + - ajout quelques log debug dans AgentM | |
5 | + - script PYROS_DOCKER_RUN démarre le serveur web et l'agentM en mode debug | |
6 | + | |
7 | +05-01-2022 (EP) : v0.3.1.1 | |
4 | 8 | - log agents : 1 dossier par agent |
5 | 9 | - log.info => format simplifié = print() |
6 | 10 | |
7 | -05-01-2022 (EP) : | |
11 | +05-01-2022 (EP) : v0.3.1.0 | |
8 | 12 | - New pyros logger : src/pyros_logger.py |
9 | 13 | |
10 | -08-12-2021 (EP) : | |
14 | +08-12-2021 (EP) : v0.3.0.0 | |
11 | 15 | - new PYROS_.py script, wrapper on pyros.py |
12 | 16 | - added this CHANGELOG file | ... | ... |
docker/PYROS_DOCKER_RUN
... | ... | @@ -13,8 +13,9 @@ echo "LOG files :" |
13 | 13 | # - Display log on current terminal |
14 | 14 | #docker exec -it pyros python3 pyros.py start webserver $@ |
15 | 15 | # - Save log in file |
16 | +docker exec pyros python3 pyros.py -d start -o guitalens webserver >> ../../LOG_PYROS_webserver.log 2>&1 & | |
16 | 17 | #docker exec pyros python3 pyros.py start webserver $@ > ../../LOG_PYROS_webserver.log 2>&1 & |
17 | -docker exec pyros python3 pyros.py start -o tnc webserver >> ../../LOG_PYROS_webserver.log 2>&1 & | |
18 | +#docker exec pyros python3 pyros.py start -o tnc webserver >> ../../LOG_PYROS_webserver.log 2>&1 & | |
18 | 19 | echo "- Webserver LOG file is ../../LOG_PYROS_webserver.log" |
19 | 20 | |
20 | 21 | # exit if webserver only |
... | ... | @@ -34,7 +35,7 @@ echo "- PLC simulator LOG file is ../../LOG_PYROS_plc_simulator.log" |
34 | 35 | # - Display log on current terminal |
35 | 36 | #docker exec -it pyros python3 pyros.py start agentM |
36 | 37 | # - Save log in file |
37 | -docker exec pyros python3 pyros.py start agentM -o "guitalens" >> ../../LOG_PYROS_agent_monitoring.log 2>&1 & | |
38 | +docker exec pyros python3 pyros.py -d start agentM -o "guitalens" >> ../../LOG_PYROS_agent_monitoring.log 2>&1 & | |
38 | 39 | echo "- Agent Monitoring LOG file is ../../LOG_PYROS_agent_monitoring.log" |
39 | 40 | |
40 | 41 | fi | ... | ... |
src/core/pyros_django/monitoring/AgentM.py
... | ... | @@ -10,7 +10,7 @@ import sys |
10 | 10 | |
11 | 11 | sys.path.append("..") |
12 | 12 | sys.path.append("../../../..") |
13 | -from src.core.pyros_django.agent.Agent import Agent, build_agent | |
13 | +from src.core.pyros_django.agent.Agent import Agent, build_agent, log | |
14 | 14 | |
15 | 15 | # PM 20190416 recycle code |
16 | 16 | from src.core.pyros_django.devices.PLC import PLCController |
... | ... | @@ -40,6 +40,9 @@ class AgentM(Agent): |
40 | 40 | print ("AGENT ENV: config PLC is (ip={}, port={})".format(plcController.ip, plcController.port)) |
41 | 41 | plc_checker = PlcChecker() |
42 | 42 | |
43 | + log.debug("PLC instanciated") | |
44 | + | |
45 | + | |
43 | 46 | |
44 | 47 | ''' |
45 | 48 | # Who should I send commands to ? |
... | ... | @@ -72,6 +75,7 @@ class AgentM(Agent): |
72 | 75 | # @override |
73 | 76 | def init(self): |
74 | 77 | super().init() |
78 | + log.debug("end init()") | |
75 | 79 | # --- Set the mode according the startmode value |
76 | 80 | ##agent_alias = self.__class__.__name__ |
77 | 81 | ##self.set_mode_from_config(agent_alias) |
... | ... | @@ -150,6 +154,7 @@ class AgentM(Agent): |
150 | 154 | # Note : in Agent.py, routine_process_body seems to be the main function of routine of the agent |
151 | 155 | # We need to override routine_process_body and not routine_process |
152 | 156 | def routine_process_body(self): |
157 | + log.debug("in routine_process_body()") | |
153 | 158 | print("TODO: we recycle code") |
154 | 159 | status_plc = self.plcController.getStatus() |
155 | 160 | if self.parseNewStatus(status_plc): |
... | ... | @@ -170,6 +175,8 @@ class AgentM(Agent): |
170 | 175 | outside.setAttribute(sensor, value) |
171 | 176 | outside.setGlobalStatus() |
172 | 177 | outside.save() |
178 | + log.debug("saved weather") | |
179 | + | |
173 | 180 | |
174 | 181 | # @override |
175 | 182 | def thread_exec_specific_cmd_main(self): | ... | ... |
src/core/pyros_django/pyros/settings.py
... | ... | @@ -404,6 +404,6 @@ python_version = subprocess.run( "python --version | cut -d ' ' -f 2 | cut -d '. |
404 | 404 | python_version = python_version.stdout |
405 | 405 | today = "2021-11-09" |
406 | 406 | django_version_major,django_version_minor = django.VERSION[:2][0],django.VERSION[:2][1] |
407 | -pyros_version = "0.3.1.1" | |
407 | +pyros_version = "0.3.1.2" | |
408 | 408 | #pyros_version = "0.2.12.0" |
409 | 409 | VERSION_NUMBER = f"{pyros_version}_{django_version_major}.{django_version_minor}_{python_version}_{today}" | ... | ... |