From a06f006771c7949fdb310bbde8a18122817a338e Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Thu, 6 Jul 2023 12:38:31 +0200 Subject: [PATCH] nouveau dossier SCRIPTS pour cleanup --- AUTHORS.md | 9 +++++++++ GEMINI_run_client.sh | 5 ----- GEMINI_test.sh | 4 ---- HOWTO_RUN.txt | 66 ------------------------------------------------------------------ HOWTO_TEST.txt | 74 -------------------------------------------------------------------------- RUN_BIG_TEST.sh | 10 ---------- SCRIPTS/GEMINI_run_client.sh | 5 +++++ SCRIPTS/GEMINI_test.sh | 4 ++++ SCRIPTS/RUN_BIG_TEST.sh | 10 ++++++++++ SCRIPTS/SHOW_ALL_LOGS.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SCRIPTS/SHOW_PYROS_LOG.sh | 1 + SCRIPTS/VERSION_SHOW | 19 +++++++++++++++++++ SHOW_ALL_LOGS.sh | 73 ------------------------------------------------------------------------- SHOW_PYROS_LOG.sh | 1 - doc/HOWTO_RUN.txt | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/HOWTO_TEST.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 261 insertions(+), 233 deletions(-) create mode 100644 AUTHORS.md delete mode 100755 GEMINI_run_client.sh delete mode 100755 GEMINI_test.sh delete mode 100644 HOWTO_RUN.txt delete mode 100644 HOWTO_TEST.txt delete mode 100755 RUN_BIG_TEST.sh create mode 100755 SCRIPTS/GEMINI_run_client.sh create mode 100755 SCRIPTS/GEMINI_test.sh create mode 100755 SCRIPTS/RUN_BIG_TEST.sh create mode 100755 SCRIPTS/SHOW_ALL_LOGS.sh create mode 100755 SCRIPTS/SHOW_PYROS_LOG.sh create mode 100755 SCRIPTS/VERSION_SHOW delete mode 100755 SHOW_ALL_LOGS.sh delete mode 100755 SHOW_PYROS_LOG.sh create mode 100644 doc/HOWTO_RUN.txt create mode 100644 doc/HOWTO_TEST.txt diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..7fedd11 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,9 @@ + +title: Authors + + +* Etienne Pallier (IRAP engineer) + +* Alain Klotz (IRAP professor) + +* Alexis Koralewski (CDD) diff --git a/GEMINI_run_client.sh b/GEMINI_run_client.sh deleted file mode 100755 index 224c4b5..0000000 --- a/GEMINI_run_client.sh +++ /dev/null @@ -1,5 +0,0 @@ -# add arg "local" to run with simulator ($1) - -cd src/device_controller/concrete_component/gemini/ -./client_telescope_gemini_controller_run.py $1 -cd - diff --git a/GEMINI_test.sh b/GEMINI_test.sh deleted file mode 100755 index 7ee4467..0000000 --- a/GEMINI_test.sh +++ /dev/null @@ -1,4 +0,0 @@ -cd src/device_controller/test/ -./test_client_gemini.py - -cd - diff --git a/HOWTO_RUN.txt b/HOWTO_RUN.txt deleted file mode 100644 index bf15eef..0000000 --- a/HOWTO_RUN.txt +++ /dev/null @@ -1,66 +0,0 @@ - - -=> ONLINE DEMO : http://pyros.irap.omp.eu - - - - -******************************* - Here is how you can RUN pyros -******************************* - -(More on this subject at https://docs.google.com/document/d/1osHT3d8GiofRd9k3nL7cz4Hcmo9WVEOcSaSSQpgJcFs/edit#heading=h.w3ny4xnj9sc8) - - - -------------------------------------------- -(A) Command-line running (no web interface): -------------------------------------------- - -(1) Running pyros interactively: - $ [python] ./pyros.py shell - -(2) Launching an agent: - $ [python] ./pyros.py start - => Ex: to start the env-monitoring agent: - $ [python] ./pyros.py start agentM - => Ex: to start agentA: - $ [python] ./pyros.py start agentA - -(3) Launching the Environment Monitoring -Open 3 different terminals -a) In terminal 1, launch the PLC simulator - $ cd simulators/plc/ - $ [python] ./plcSimulator.py -b) In terminal 2, launch the Monitoring agent - $ [python] ./pyros.py start agentM -c) In terminal 3, launch the webserver - $ [python] ./pyros.py start webserver -d) With a browser, go to the Environment Monitoring dashboard - - See the current weather : - Click on Weather (or go to http://127.0.0.1:8000/dashboard/weather - - Configure the monitoring : - Go to http://127.0.0.1:8000/monitoring/weather/config - -(4) Launching many agents: - $ [python] ./pyros.py start ,,. - => Ex: start agentA and agentB - $ [python] ./pyros.py start agentA,agentB - => You could also start ALL agents at once: - $ [python] ./pyros.py start all - - -------------------------------------------- -(B) Running with the website -------------------------------------------- - -(1) Start only the webserver (for pyros website) - $ [python] ./pyros.py start webserver -Then, connect to http://localhost:8000 -You can also connect to the admin interface: http://localhost:8000/admin -(Login as 'pyros' with the password 'DjangoPyros') - -(2) Now, you can start some (or all) agents to have the website come to life ! -See section (A) just above - - diff --git a/HOWTO_TEST.txt b/HOWTO_TEST.txt deleted file mode 100644 index 633294b..0000000 --- a/HOWTO_TEST.txt +++ /dev/null @@ -1,74 +0,0 @@ - -************************************************************************************* - Here is how you can TEST that pyros is working well (ensure that nothing is broken) -************************************************************************************* - -(More on this subject at https://docs.google.com/document/d/1osHT3d8GiofRd9k3nL7cz4Hcmo9WVEOcSaSSQpgJcFs/edit#heading=h.odcd50f0rjwh) - - -(A) Running the unit tests suite: -- (1) Some unit tests only: - $ ./pyros.py test -- (2) All unit tests: - $ ./pyros.py testall - -(B) Test with agents: -- (1) FULL Test with agentMultiRequester (AgentMajordome like) sending commands to several device agents at once : - the Gemini telescope device agent (or simulator), and the SBIG device agent (or simulator): - $ ./pyros.py -ts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester - (add "-d" option for debug mode) -- (2) Test against REAL Gemini telescope - $ ./pyros.py -t start agentDeviceGemini,agentMultiRequester - -****** -OLD OBSOLETE TESTS: -- Test with agentA and agentB sending commands to each other: - $ ./pyros.py -t start agentA,agentB -- Test with agentTelescopeRequester sending commands to the Gemini telescope (or its simulator) : - - test with telescope SIMULATOR (use -s option) : - $ ./pyros.py -ts start agentDeviceGemini,agentTelescopeRequester - - test with REAL telescope : - $ ./pyros.py -t start agentDeviceGemini,agentTelescopeRequester -****** - -(C) Interactive testing: - $ ./pyros.py shell - -(D) Devices testing: - $ cd src/devices_controller/ -Suivre les instructions du document README.md de ce dossier - - - - - - - -************************************************************************************************* - Use netstat to see if a simulator is (still) listening and should thus be killed manually -************************************************************************************************* - -$ netstat -tnl | grep 1111 -udp4 0 0 127.0.0.1.11112 *.* -udp4 0 0 127.0.0.1.11110 *.* - -To see which processus is responsible for this connection, use -v (or -p on linux) -$ netstat -tnlv | grep 1111 -udp4 0 0 127.0.0.1.11112 *.* 786896 9216 24386 0 0x0000 0x00000000 -udp4 0 0 127.0.0.1.11110 *.* 786896 9216 3226 0 0x0000 0x00000000 - -Here, we see that process 3226 has launched a simulator on port 11110 -To see this process detailed : -$ ps -efl|grep 3226 - 501 3226 1 0 30sep19 ?? 0:41.77 /usr/local/Cella 4046 31 0 4331296 608 - S 0 - -Idem for process 24386: -$ ps -efl|grep 24386 - 501 24386 1 0 4:04 ttys001 0:01.15 /usr/local/Cella 4046 31 0 4332056 40156 - S 0 - -Information about a specific process: -$ ps -p 24386 -24386 ttys001 0:01.24 /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python AgentDeviceSBIG.py -t -s - -=> Now, we are sure this is the right process to kill - diff --git a/RUN_BIG_TEST.sh b/RUN_BIG_TEST.sh deleted file mode 100755 index 3c8276b..0000000 --- a/RUN_BIG_TEST.sh +++ /dev/null @@ -1,10 +0,0 @@ - -echo -echo "./pyros.py -ts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester" -echo - -# NORMAL MODE -./pyros.py -ts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester - -# DEBUG MODE -#./pyros.py -dts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester diff --git a/SCRIPTS/GEMINI_run_client.sh b/SCRIPTS/GEMINI_run_client.sh new file mode 100755 index 0000000..224c4b5 --- /dev/null +++ b/SCRIPTS/GEMINI_run_client.sh @@ -0,0 +1,5 @@ +# add arg "local" to run with simulator ($1) + +cd src/device_controller/concrete_component/gemini/ +./client_telescope_gemini_controller_run.py $1 +cd - diff --git a/SCRIPTS/GEMINI_test.sh b/SCRIPTS/GEMINI_test.sh new file mode 100755 index 0000000..7ee4467 --- /dev/null +++ b/SCRIPTS/GEMINI_test.sh @@ -0,0 +1,4 @@ +cd src/device_controller/test/ +./test_client_gemini.py + +cd - diff --git a/SCRIPTS/RUN_BIG_TEST.sh b/SCRIPTS/RUN_BIG_TEST.sh new file mode 100755 index 0000000..3c8276b --- /dev/null +++ b/SCRIPTS/RUN_BIG_TEST.sh @@ -0,0 +1,10 @@ + +echo +echo "./pyros.py -ts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester" +echo + +# NORMAL MODE +./pyros.py -ts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester + +# DEBUG MODE +#./pyros.py -dts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester diff --git a/SCRIPTS/SHOW_ALL_LOGS.sh b/SCRIPTS/SHOW_ALL_LOGS.sh new file mode 100755 index 0000000..abd2fd8 --- /dev/null +++ b/SCRIPTS/SHOW_ALL_LOGS.sh @@ -0,0 +1,73 @@ +nblinestoshow=50 +path=config/logs/ +day=`date +%Y%m%d` + +echo +echo +echo +echo +echo +echo +echo +echo +echo +echo +echo + + +echo +echo +echo "*****************************************************************************************************************************" +echo +echo +file=$path/pyros2_last.log +echo "CHRONO LAST LOG ($file):" +nblines=`wc -l $file` +echo "Nb lines = $nblines" +echo +cat $file + +echo +echo +echo "*****************************************************************************************************************************" +echo +echo +file=$path/pyros2_$day.log +echo "CHRONO FULL LOG ($file):" +tail -n $nblinestoshow $file + + +agent=AgentDeviceGemini +path=$path/$agent/ +echo +echo +echo "*****************************************************************************************************************************" +echo +echo +file=$path/${agent}_last.log +echo "$agent LAST LOG ($file):" +nblines=`wc -l $file` +echo "Nb lines = $nblines" +echo +cat $file + +echo +echo +echo "*****************************************************************************************************************************" +echo +echo +file=$path/${agent}_$day.log +echo "$agent FULL LOG ($file):" +tail -n $nblinestoshow $file + + +echo +echo +echo "*****************************************************************************************************************************" +echo +echo +path=config/logs/ +file=$path/pyros_warn.log +echo "WARNING/ERRORS LOG ($file):" +echo +cat $file diff --git a/SCRIPTS/SHOW_PYROS_LOG.sh b/SCRIPTS/SHOW_PYROS_LOG.sh new file mode 100755 index 0000000..9fc36ee --- /dev/null +++ b/SCRIPTS/SHOW_PYROS_LOG.sh @@ -0,0 +1 @@ +tail -f config/logs/pyros_last.log diff --git a/SCRIPTS/VERSION_SHOW b/SCRIPTS/VERSION_SHOW new file mode 100755 index 0000000..572a77f --- /dev/null +++ b/SCRIPTS/VERSION_SHOW @@ -0,0 +1,19 @@ +echo +echo "- PyROS version: " +#grep "pyros_version =" src/core/pyros_django/pyros/settings.py +cat VERSION + +#grep -i "version 0." BASE_TEMPLATE.HTML + +echo +echo "- Python version :" +python3 --version + +echo +echo "- Django version :" +python3 -m django --version + +echo +echo "- MySQL version :" +mysql --version + diff --git a/SHOW_ALL_LOGS.sh b/SHOW_ALL_LOGS.sh deleted file mode 100755 index abd2fd8..0000000 --- a/SHOW_ALL_LOGS.sh +++ /dev/null @@ -1,73 +0,0 @@ -nblinestoshow=50 -path=config/logs/ -day=`date +%Y%m%d` - -echo -echo -echo -echo -echo -echo -echo -echo -echo -echo -echo - - -echo -echo -echo "*****************************************************************************************************************************" -echo -echo -file=$path/pyros2_last.log -echo "CHRONO LAST LOG ($file):" -nblines=`wc -l $file` -echo "Nb lines = $nblines" -echo -cat $file - -echo -echo -echo "*****************************************************************************************************************************" -echo -echo -file=$path/pyros2_$day.log -echo "CHRONO FULL LOG ($file):" -tail -n $nblinestoshow $file - - -agent=AgentDeviceGemini -path=$path/$agent/ -echo -echo -echo "*****************************************************************************************************************************" -echo -echo -file=$path/${agent}_last.log -echo "$agent LAST LOG ($file):" -nblines=`wc -l $file` -echo "Nb lines = $nblines" -echo -cat $file - -echo -echo -echo "*****************************************************************************************************************************" -echo -echo -file=$path/${agent}_$day.log -echo "$agent FULL LOG ($file):" -tail -n $nblinestoshow $file - - -echo -echo -echo "*****************************************************************************************************************************" -echo -echo -path=config/logs/ -file=$path/pyros_warn.log -echo "WARNING/ERRORS LOG ($file):" -echo -cat $file diff --git a/SHOW_PYROS_LOG.sh b/SHOW_PYROS_LOG.sh deleted file mode 100755 index 9fc36ee..0000000 --- a/SHOW_PYROS_LOG.sh +++ /dev/null @@ -1 +0,0 @@ -tail -f config/logs/pyros_last.log diff --git a/doc/HOWTO_RUN.txt b/doc/HOWTO_RUN.txt new file mode 100644 index 0000000..bf15eef --- /dev/null +++ b/doc/HOWTO_RUN.txt @@ -0,0 +1,66 @@ + + +=> ONLINE DEMO : http://pyros.irap.omp.eu + + + + +******************************* + Here is how you can RUN pyros +******************************* + +(More on this subject at https://docs.google.com/document/d/1osHT3d8GiofRd9k3nL7cz4Hcmo9WVEOcSaSSQpgJcFs/edit#heading=h.w3ny4xnj9sc8) + + + +------------------------------------------- +(A) Command-line running (no web interface): +------------------------------------------- + +(1) Running pyros interactively: + $ [python] ./pyros.py shell + +(2) Launching an agent: + $ [python] ./pyros.py start + => Ex: to start the env-monitoring agent: + $ [python] ./pyros.py start agentM + => Ex: to start agentA: + $ [python] ./pyros.py start agentA + +(3) Launching the Environment Monitoring +Open 3 different terminals +a) In terminal 1, launch the PLC simulator + $ cd simulators/plc/ + $ [python] ./plcSimulator.py +b) In terminal 2, launch the Monitoring agent + $ [python] ./pyros.py start agentM +c) In terminal 3, launch the webserver + $ [python] ./pyros.py start webserver +d) With a browser, go to the Environment Monitoring dashboard + - See the current weather : + Click on Weather (or go to http://127.0.0.1:8000/dashboard/weather + - Configure the monitoring : + Go to http://127.0.0.1:8000/monitoring/weather/config + +(4) Launching many agents: + $ [python] ./pyros.py start ,,. + => Ex: start agentA and agentB + $ [python] ./pyros.py start agentA,agentB + => You could also start ALL agents at once: + $ [python] ./pyros.py start all + + +------------------------------------------- +(B) Running with the website +------------------------------------------- + +(1) Start only the webserver (for pyros website) + $ [python] ./pyros.py start webserver +Then, connect to http://localhost:8000 +You can also connect to the admin interface: http://localhost:8000/admin +(Login as 'pyros' with the password 'DjangoPyros') + +(2) Now, you can start some (or all) agents to have the website come to life ! +See section (A) just above + + diff --git a/doc/HOWTO_TEST.txt b/doc/HOWTO_TEST.txt new file mode 100644 index 0000000..633294b --- /dev/null +++ b/doc/HOWTO_TEST.txt @@ -0,0 +1,74 @@ + +************************************************************************************* + Here is how you can TEST that pyros is working well (ensure that nothing is broken) +************************************************************************************* + +(More on this subject at https://docs.google.com/document/d/1osHT3d8GiofRd9k3nL7cz4Hcmo9WVEOcSaSSQpgJcFs/edit#heading=h.odcd50f0rjwh) + + +(A) Running the unit tests suite: +- (1) Some unit tests only: + $ ./pyros.py test +- (2) All unit tests: + $ ./pyros.py testall + +(B) Test with agents: +- (1) FULL Test with agentMultiRequester (AgentMajordome like) sending commands to several device agents at once : + the Gemini telescope device agent (or simulator), and the SBIG device agent (or simulator): + $ ./pyros.py -ts start agentDeviceGemini,agentDeviceSBIG,agentMultiRequester + (add "-d" option for debug mode) +- (2) Test against REAL Gemini telescope + $ ./pyros.py -t start agentDeviceGemini,agentMultiRequester + +****** +OLD OBSOLETE TESTS: +- Test with agentA and agentB sending commands to each other: + $ ./pyros.py -t start agentA,agentB +- Test with agentTelescopeRequester sending commands to the Gemini telescope (or its simulator) : + - test with telescope SIMULATOR (use -s option) : + $ ./pyros.py -ts start agentDeviceGemini,agentTelescopeRequester + - test with REAL telescope : + $ ./pyros.py -t start agentDeviceGemini,agentTelescopeRequester +****** + +(C) Interactive testing: + $ ./pyros.py shell + +(D) Devices testing: + $ cd src/devices_controller/ +Suivre les instructions du document README.md de ce dossier + + + + + + + +************************************************************************************************* + Use netstat to see if a simulator is (still) listening and should thus be killed manually +************************************************************************************************* + +$ netstat -tnl | grep 1111 +udp4 0 0 127.0.0.1.11112 *.* +udp4 0 0 127.0.0.1.11110 *.* + +To see which processus is responsible for this connection, use -v (or -p on linux) +$ netstat -tnlv | grep 1111 +udp4 0 0 127.0.0.1.11112 *.* 786896 9216 24386 0 0x0000 0x00000000 +udp4 0 0 127.0.0.1.11110 *.* 786896 9216 3226 0 0x0000 0x00000000 + +Here, we see that process 3226 has launched a simulator on port 11110 +To see this process detailed : +$ ps -efl|grep 3226 + 501 3226 1 0 30sep19 ?? 0:41.77 /usr/local/Cella 4046 31 0 4331296 608 - S 0 + +Idem for process 24386: +$ ps -efl|grep 24386 + 501 24386 1 0 4:04 ttys001 0:01.15 /usr/local/Cella 4046 31 0 4332056 40156 - S 0 + +Information about a specific process: +$ ps -p 24386 +24386 ttys001 0:01.24 /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python AgentDeviceSBIG.py -t -s + +=> Now, we are sure this is the right process to kill + -- libgit2 0.21.2