Scripts
Version 5 (Paul Carensac, 08/09/2016 11:27 am)
1 | 1 | Paul Carensac | h1. Scripts |
---|---|---|---|
2 | 1 | Paul Carensac | |
3 | 5 | Paul Carensac | Explanations about the scripts. |
4 | 1 | Paul Carensac | |
5 | 3 | Paul Carensac | {{>toc}} |
6 | 3 | Paul Carensac | |
7 | 1 | Paul Carensac | --- |
8 | 1 | Paul Carensac | |
9 | 5 | Paul Carensac | Most of them are located in src/scripts/ folder : |
10 | 1 | Paul Carensac | |
11 | 5 | Paul Carensac | h3. celery_test.sh / .bat |
12 | 5 | Paul Carensac | |
13 | 1 | Paul Carensac | * *Goal* |
14 | 1 | Paul Carensac | Run tests using the production database in order to see the celery results (celery is always running on production database). |
15 | 1 | Paul Carensac | |
16 | 4 | Paul Carensac | * *Argument(s)* |
17 | 2 | Paul Carensac | You need to give the app / TestClass / test_name to run it (prevents a fail test launching, polluting the production DB) |
18 | 2 | Paul Carensac | |
19 | 1 | Paul Carensac | * *How it works ?* |
20 | 1 | Paul Carensac | |
21 | 2 | Paul Carensac | * Moves to src/ folder |
22 | 1 | Paul Carensac | * 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) |
23 | 2 | Paul Carensac | * Runs the test(s) you gave with --kepdb and --nomigrations in order to preserve the production DB |
24 | 2 | Paul Carensac | |
25 | 2 | Paul Carensac | |
26 | 2 | Paul Carensac | h3. delete_all_request.sh |
27 | 2 | Paul Carensac | |
28 | 2 | Paul Carensac | * *Goal* |
29 | 2 | Paul Carensac | Deletes all the Alerts, Requests, Sequences, Albums and Plan from the current DB (the one chosen in settings.py) |
30 | 2 | Paul Carensac | The goal is to easily clean the DB |
31 | 2 | Paul Carensac | |
32 | 2 | Paul Carensac | * *How it works ?* |
33 | 2 | Paul Carensac | |
34 | 2 | Paul Carensac | * Moves to src/ folder |
35 | 2 | Paul Carensac | * Checks in settings.py whether MySQL or SQLite is used |
36 | 2 | Paul Carensac | * Uses SQL inline command to delete the fields in the current DB |
37 | 2 | Paul Carensac | |
38 | 2 | Paul Carensac | |
39 | 5 | Paul Carensac | h3. kill_celery_workers.sh / .bat |
40 | 2 | Paul Carensac | |
41 | 2 | Paul Carensac | * *Goal* |
42 | 2 | Paul Carensac | Deletes all the celery workers running (in background, or not) |
43 | 2 | Paul Carensac | |
44 | 2 | Paul Carensac | * *How it works ?* |
45 | 2 | Paul Carensac | |
46 | 1 | Paul Carensac | * Lists all the process running on the computer |
47 | 2 | Paul Carensac | * Looks for "celery worker" matching one |
48 | 2 | Paul Carensac | * Gets their PIDs |
49 | 2 | Paul Carensac | * Send them a kill -9 message |
50 | 2 | Paul Carensac | |
51 | 2 | Paul Carensac | |
52 | 5 | Paul Carensac | h3. start_celery_worker.sh / .bat |
53 | 2 | Paul Carensac | |
54 | 2 | Paul Carensac | * *Goal* |
55 | 1 | Paul Carensac | Starts the celery workers, giving them a queue and a name |
56 | 1 | Paul Carensac | |
57 | 1 | Paul Carensac | * *How it works ?* |
58 | 1 | Paul Carensac | |
59 | 1 | Paul Carensac | * Moves to src/ folder |
60 | 1 | Paul Carensac | * Kills the workers still running |
61 | 1 | Paul Carensac | * Starts every worker one by one (in background using '&'), giving them a queue, a name, and purging the associated queue if needed |
62 | 5 | Paul Carensac | |
63 | 5 | Paul Carensac | |
64 | 5 | Paul Carensac | h3. test_all_usual.sh / .bat |
65 | 5 | Paul Carensac | |
66 | 5 | Paul Carensac | * *Goal* |
67 | 5 | Paul Carensac | Run all the tests that don't need celery |
68 | 5 | Paul Carensac | |
69 | 5 | Paul Carensac | * *How it works ?* |
70 | 5 | Paul Carensac | |
71 | 5 | Paul Carensac | * Just use python manage.py test command with all the wanted tests |
72 | 5 | Paul Carensac | |
73 | 5 | Paul Carensac | |
74 | 5 | Paul Carensac | --- |
75 | 5 | Paul Carensac | |
76 | 5 | Paul Carensac | They are also two scripts in the simulators/ folder : |
77 | 5 | Paul Carensac | |
78 | 5 | Paul Carensac | |
79 | 5 | Paul Carensac | h3. run_all.sh |
80 | 5 | Paul Carensac | |
81 | 5 | Paul Carensac | * *Goal* |
82 | 5 | Paul Carensac | Run all the simulators in background |
83 | 5 | Paul Carensac | |
84 | 5 | Paul Carensac | * *How it works ?* |
85 | 5 | Paul Carensac | |
86 | 5 | Paul Carensac | * Launches each simulator in background with python |
87 | 5 | Paul Carensac | |
88 | 5 | Paul Carensac | h3. kill_all.sh |
89 | 5 | Paul Carensac | |
90 | 5 | Paul Carensac | * *Goal* |
91 | 5 | Paul Carensac | Kill all simulators process in background |
92 | 5 | Paul Carensac | |
93 | 5 | Paul Carensac | * *How it works ?* |
94 | 5 | Paul Carensac | |
95 | 5 | Paul Carensac | * Finds the process IDs corresponding to the simulators and kills them |
96 | 5 | Paul Carensac | |
97 | 5 | Paul Carensac | --- |
98 | 5 | Paul Carensac | |
99 | 5 | Paul Carensac | The script that should be used by users to run the project's functionalities is in the PYROS/ root folder : |
100 | 5 | Paul Carensac | |
101 | 5 | Paul Carensac | |
102 | 5 | Paul Carensac | h3. pyrosrun.sh / .bat |
103 | 5 | Paul Carensac | |
104 | 5 | Paul Carensac | * *Goal* |
105 | 5 | Paul Carensac | Allow to run every feature of the project from its root (runserver, tests, celery, ...) |
106 | 5 | Paul Carensac | |
107 | 5 | Paul Carensac | * *How it works ?* |
108 | 5 | Paul Carensac | |
109 | 5 | Paul Carensac | * 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 |