Scripts

Version 4 (Paul Carensac, 08/08/2016 05:18 pm) → Version 5/10 (Paul Carensac, 08/09/2016 11:27 am)

h1. Scripts

Explanations about the scripts.

{{>toc}}

---

Most of them
They are located in src/scripts/ folder :



{{>toc}}

---

h3. celery_test.sh / .bat

* *Goal*
Run tests using the production database in order to see the celery results (celery is always running on production database).

* *Argument(s)*
You need to give the app / TestClass / test_name to run it (prevents a fail test launching, polluting the production DB)

* *How it works ?*

* Moves to src/ folder
* Uses sed command to set CELERY_TEST variable to 'True' in settings.py (The consequence is that the production DB will be chosen for tests in settings.py)
* Runs the test(s) you gave with --kepdb and --nomigrations in order to preserve the production DB



---

h3. delete_all_request.sh

* *Goal*
Deletes all the Alerts, Requests, Sequences, Albums and Plan from the current DB (the one chosen in settings.py)
The goal is to easily clean the DB

* *How it works ?*

* Moves to src/ folder
* Checks in settings.py whether MySQL or SQLite is used
* Uses SQL inline command to delete the fields in the current DB



---

h3. kill_celery_workers.sh / .bat

* *Goal*
Deletes all the celery workers running (in background, or not)

* *How it works ?*

* Lists all the process running on the computer
* Looks for "celery worker" matching one
* Gets their PIDs
* Send them a kill -9 message



---

h3. start_celery_worker.sh / .bat

* *Goal*
Starts the celery workers, giving them a queue and a name

* *How it works ?*

* Moves to src/ folder
* Kills the workers still running
* Starts every worker one by one (in background using '&'), giving them a queue, a name, and purging the associated queue if needed

h3. test_all_usual.sh / .bat

* *Goal*
Run all the tests that don't need celery

* *How it works ?*

* Just use python manage.py test command with all the wanted tests

---

They are also two scripts in the simulators/ folder :

h3. run_all.sh

* *Goal*
Run all the simulators in background

* *How it works ?*

* Launches each simulator in background with python

h3. kill_all.sh

* *Goal*
Kill all simulators process in background

* *How it works ?*

* Finds the process IDs corresponding to the simulators and kills them

---

The script that should be used by users to run the project's functionalities is in the PYROS/ root folder :

h3. pyrosrun.sh / .bat

* *Goal*
Allow to run every feature of the project from its root (runserver, tests, celery, ...)

* *How it works ?*

* It calls the manage.py commands and the other scripts, according to the given parameters (see the usage message) <== This script should be improved before the 12/08/2016