Merge in RR/pyinfra from add-prometheus-metrics to master
Squashed commit of the following:
commit 3736e867bfb105f2c2601f6d25343c996027cc5f
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Wed Mar 16 11:35:25 2022 +0100
removed obsolete config entry
commit dc191b17d863ec4f8009fb130c2c3a78d4116969
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Wed Mar 16 11:34:12 2022 +0100
removed obsolete dependency
commit 5ba9765e88da7dd15700b211794f433a6f7ea0df
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Wed Mar 16 11:32:37 2022 +0100
changed error handling for prometheus endpoint
commit 894a6b5d4c7026b9a703a8b2cd70641e7ed7323b
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Wed Mar 16 11:16:39 2022 +0100
fixed definition order broken by auto-refac; reduced prometheus code to only forwarding to analysis endpoint
commit 9f3c884c75289c7b558e8cc8fb0154b5ddd3a323
Author: Julius Unverfehrt <julius.unverfehrt@iqser.com>
Date: Wed Mar 16 08:59:45 2022 +0100
black is back
commit 5950799e03f3578ff58f19430494c6b0c223c0f6
Author: Julius Unverfehrt <julius.unverfehrt@iqser.com>
Date: Wed Mar 16 08:59:11 2022 +0100
add prometheus memory peak monitoring, combine report with analysis report
Infrastructure to deploy Research Projects
The Infrastructure expects to be deployed in the same Pod / local environment as the analysis container and handles all outbound communication.
Configuration
A configuration is located in /config.yaml. All relevant variables can be configured via exporting environment variables.
| Environment Variable | Default | Description |
|---|---|---|
| LOGGING_LEVEL_ROOT | DEBUG | Logging level for service logger |
| PROBING_WEBSERVER_HOST | "0.0.0.0" | Probe webserver address |
| PROBING_WEBSERVER_PORT | 8080 | Probe webserver port |
| PROBING_WEBSERVER_MODE | production | Webserver mode: {development, production} |
| RABBITMQ_HOST | localhost | RabbitMQ host address |
| RABBITMQ_PORT | 5672 | RabbitMQ host port |
| RABBITMQ_USERNAME | user | RabbitMQ username |
| RABBITMQ_PASSWORD | bitnami | RabbitMQ password |
| RABBITMQ_HEARTBEAT | 7200 | Controls AMQP heartbeat timeout in seconds |
| REQUEST_QUEUE | request_queue | Requests to service |
| RESPONSE_QUEUE | response_queue | Responses by service |
| DEAD_LETTER_QUEUE | dead_letter_queue | Messages that failed to process |
| ANALYSIS_ENDPOINT | "http://127.0.0.1:5000" | Endpoint for analysis container |
| STORAGE_BACKEND | s3 | The type of storage to use {s3, azure} |
| STORAGE_BUCKET | "pyinfra-test-bucket" | The bucket / container to pull files specified in queue requests from |
| STORAGE_ENDPOINT | "http://127.0.0.1:9000" | Endpoint for s3 storage |
| STORAGE_KEY | root | User for s3 storage |
| STORAGE_SECRET | password | Password for s3 storage |
| STORAGE_AZURECONNECTIONSTRING | "DefaultEndpointsProtocol=..." | Connection string for Azure storage |
Response Format
Expected AMQP input message:
{
"dossierId": "",
"fileId": "",
"targetFileExtension": "",
"responseFileExtension": ""
}
Optionally, the input message can contain a field with the key "operations".
AMQP output message:
{
"dossierId": "",
"fileId": "",
...
}
Development
Either run src/serve.py or the built Docker image.
Setup
Install module.
pip install -e .
pip install -r requirements.txt
or build docker image.
docker build -f Dockerfile -t pyinfra .
Usage
Shell 1: Start a MinIO and a RabbitMQ docker container.
docker-compose up
Shell 2: Add files to the local minio storage.
python scripts/manage_minio.py add <MinIO target folder> -d path/to/a/folder/with/PDFs
Shell 2: Run pyinfra-server.
python src/serve.py
or as container:
docker run --net=host pyinfra
Shell 3: Run analysis-container.
Shell 4: Start a client that sends requests to process PDFs from the MinIO store and annotates these PDFs according to the service responses.
python scripts/mock_client.py
Description
Release 4.1.0
Latest
Languages
Python
96.7%
Makefile
2%
Shell
1.3%