Browse Source

Some doc work

Maximilian Korndörfer 2 years ago
parent
commit
0316511974
1 changed files with 47 additions and 2 deletions
  1. 47
    2
      README.md

+ 47
- 2
README.md View File

@@ -7,12 +7,55 @@ It uses MongoDB as Datastorage.
7 7
 
8 8
 It communicates with the matching workers using RabbitMq message queuing.
9 9
 
10
+## Architecture
10 11
 
11
-### Working environment
12
+The Python architecture divides into three parts.
13
+1. The data model that the other components are using.
14
+2. The REST API. 
15
+It receives the Starhunter Updates, Pushes them into the MongoDB and creates Tasks for the Worker.
16
+3. The Worker.
17
+It consumes Tasks and pushes the results back to the Starhunter.
18
+Every change of an entity leads to one Task being created and one push back to the starhunter.
19
+
20
+As communication between Rest-API and Workers a Message Queue Service is used.
21
+On Python side we use Celery and the Server is RabbitMQ.
22
+
23
+# Working environment
12 24
 
13 25
 The api runs in a separate environment provided by a Docker image.
14 26
 First of all you need to install `docker` and `docker-compose`.
15 27
 
28
+## Debugging
29
+PyCharm Debugger can be attached to Docker Containers. This is very useful for debugging.
30
+
31
+Please make yourself familiar with this method before going on 
32
+and create separate run profiles for running the worker and the rest api with the Docker Compose context.
33
+
34
+### API
35
+The API part can be run without bigger problems local or in the docker container.
36
+Long waiting times most likely indicate that the database can not be connected.
37
+
38
+### Worker
39
+The worker can be a little bit tricky to debug.
40
+
41
+However, there are some possibilities to do this:
42
+
43
+#### Run a test worker in pure python
44
+You can run the flask api in the docker container 
45
+and have your local python installation running the `python worker_test_runner.py`.
46
+Please edit the file for your current debug action (e.g. which yp or cp to process).
47
+
48
+#### Run a test worker with celery
49
+You can run the worker with celery.
50
+
51
+This can be done in the container (it happens when you run `docker-compose up`). 
52
+This is useful when you want to have a test calculation based on some changes.
53
+
54
+You can also run the worker with celery locally. 
55
+This is rather complicated to achieve and I would not recommend this unless you smell some trouble in the celery multitasking or the worker data exchange.
56
+
57
+You can also attach a worker (with attached Debug Console) to the prod system. 
58
+Just provide the relevant environmental variables and a tunnel to the MongoDB and the RabbitMQ server.
16 59
 
17 60
 ### Get it up & running
18 61
 
@@ -20,4 +63,6 @@ Just type
20 63
 
21 64
 `docker-compose up`
22 65
 
23
-That's it!
66
+That's it!
67
+
68
+# Get test data

Loading…
Cancel
Save