Scripts
Version 2 (Paul Carensac, 05/13/2016 03:59 pm)
1 | 1 | Paul Carensac | h1. Scripts |
---|---|---|---|
2 | 1 | Paul Carensac | |
3 | 1 | Paul Carensac | Explanations about the scripts. They are located in src/scripts/ folder |
4 | 1 | Paul Carensac | |
5 | 1 | Paul Carensac | --- |
6 | 1 | Paul Carensac | |
7 | 1 | Paul Carensac | h3. celery_test.sh |
8 | 1 | Paul Carensac | |
9 | 1 | Paul Carensac | * *Goal* |
10 | 1 | Paul Carensac | Run tests using the production database in order to see the celery results (celery is always running on production database). |
11 | 1 | Paul Carensac | |
12 | 2 | Paul Carensac | * *Argument(s) |
13 | 2 | Paul Carensac | You need to give the app / TestClass / test_name to run it (prevents a fail test launching, polluting the production DB) |
14 | 2 | Paul Carensac | |
15 | 1 | Paul Carensac | * *How it works ?* |
16 | 1 | Paul Carensac | |
17 | 1 | Paul Carensac | * Moves to src/ folder |
18 | 2 | 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) |
19 | 1 | Paul Carensac | * Runs the test(s) you gave with --kepdb and --nomigrations in order to preserve the production DB |
20 | 2 | Paul Carensac | |
21 | 2 | Paul Carensac | --- |
22 | 2 | Paul Carensac | |
23 | 2 | Paul Carensac | h3. delete_all_request.sh |
24 | 2 | Paul Carensac | |
25 | 2 | Paul Carensac | * *Goal* |
26 | 2 | Paul Carensac | Deletes all the Alerts, Requests, Sequences, Albums and Plan from the current DB (the one chosen in settings.py) |
27 | 2 | Paul Carensac | The goal is to easily clean the DB |
28 | 2 | Paul Carensac | |
29 | 2 | Paul Carensac | * *How it works ?* |
30 | 2 | Paul Carensac | |
31 | 2 | Paul Carensac | * Moves to src/ folder |
32 | 2 | Paul Carensac | * Checks in settings.py whether MySQL or SQLite is used |
33 | 2 | Paul Carensac | * Uses SQL inline command to delete the fields in the current DB |
34 | 2 | Paul Carensac | |
35 | 2 | Paul Carensac | --- |
36 | 2 | Paul Carensac | |
37 | 2 | Paul Carensac | h3. kill_celery_workers.sh |
38 | 2 | Paul Carensac | |
39 | 2 | Paul Carensac | * *Goal* |
40 | 2 | Paul Carensac | Deletes all the celery workers running (in background, or not) |
41 | 2 | Paul Carensac | |
42 | 2 | Paul Carensac | * *How it works ?* |
43 | 2 | Paul Carensac | |
44 | 2 | Paul Carensac | * Lists all the process running on the computer |
45 | 2 | Paul Carensac | * Looks for "celery worker" matching one |
46 | 2 | Paul Carensac | * Gets their PIDs |
47 | 2 | Paul Carensac | * Send them a kill -9 message |
48 | 2 | Paul Carensac | |
49 | 2 | Paul Carensac | --- |
50 | 2 | Paul Carensac | |
51 | 2 | Paul Carensac | h3. start_celery_worker.sh |
52 | 2 | Paul Carensac | |
53 | 2 | Paul Carensac | * *Goal* |
54 | 2 | Paul Carensac | Starts the celery workers, giving them a queue and a name |
55 | 2 | Paul Carensac | |
56 | 2 | Paul Carensac | * *How it works ?* |
57 | 2 | Paul Carensac | |
58 | 2 | Paul Carensac | * Moves to src/ folder |
59 | 2 | Paul Carensac | * Kills the workers still running |
60 | 2 | Paul Carensac | * Starts every worker one by one (in background using '&'), giving them a queue, a name, and purging the associated queue if needed |