Matthias Bisping 1147a5dc33 Pull request #23: tests are now run in a container
Merge in RR/pyinfra from containerized_tests to master

Squashed commit of the following:

commit 63f016a7f76af9c91602cf958639ad7fd9b4e832
Merge: 3b399ca 11c9f8a
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 15:07:25 2022 +0100

    Merge branch 'master' into containerized_tests

commit 3b399ca873c1625cde5a34c3b34fd11653af36e4
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 15:03:32 2022 +0100

    removed obsolete log

commit f854695fc22a9853449a1377d5285cc0cd60caf8
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 15:01:22 2022 +0100

    refactoring of imports

commit 72b5c597aa3e5b8ce7c16fb1abeaca8e48015597
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 15:00:37 2022 +0100

    removed obsolete code

commit ee9b0117f6c86fc23be9316b2c3690773c914e79
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:59:42 2022 +0100

    removed obsolete code

commit 020cad6e5b7cdb8e2ad867f5bcc51d5114b281f4
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:54:09 2022 +0100

    undo debug intentional crash

commit 65b77cffd319bc5230ead26391dc6b841ad8e12e
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:51:46 2022 +0100

    debug intentional crash

commit 06133189bc6ecafd0c5a9bc74b8c08b9c097a321
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:49:03 2022 +0100

    fixed syntax error in sconarscan

commit 7468c0738fe7ddabf72baaa07e7422a23c2a6f00
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:43:43 2022 +0100

    failing sonar job if coverage.xml not present as proxcy for failed tests

commit ebcee7ff2a53c643efb64b835f99640567da224b
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:36:34 2022 +0100

    simplified copying of coverage.xml and removing of testcontainer

commit 1fb24d67f10aebe2747b76a4990a3c9fe2c0b00b
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:18:30 2022 +0100

    RABBITMQ_DISK_FREE_ABSOLUTE_LIMIT=20Gi

commit 07873d607097308c5371029a74e115895266d30c
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:12:51 2022 +0100

    RABBITMQ_DISK_FREE_RELATIVE_LIMIT=5%

commit d8eb294fb18c5b0b2418d8a397ef66ef133081bf
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:11:00 2022 +0100

    RABBITMQ_DISK_FREE_RELATIVE_LIMIT=100%

commit f9010ed998f2a5da3940ad3f0d8a2a8cff209b0d
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 14:04:35 2022 +0100

    RABBITMQ_VM_MEMORY_HIGH_WATERMARK=100%

commit 41e9f8046aae66fc9a7248b7c6194fe7e9e9c814
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 13:42:34 2022 +0100

    RABBITMQ_VM_MEMORY_HIGH_WATERMARK=0

commit 301ba05d66452cf5b85511527a35582cd1396803
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 13:19:10 2022 +0100

    set AMPQ heartbeat

commit 9f4dfb9781847bed6077d49e931719c04460e88c
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 10:42:21 2022 +0100

    channel and connection closing experimenting

commit e3812725acff1df2a26e337dbc88df11cd6b8b22
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 10:12:15 2022 +0100

    pika tearndown adjusted

commit 0206be86669c9f4b70bb21d416d6f10ce5e8731a
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 09:58:18 2022 +0100

    return instead of yield in Consumer.consume

commit 17e11adf7822916dd3ece201529796e4dfd89032
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Mar 24 09:51:52 2022 +0100

    processing log added to test

... and 26 more commits
2022-03-24 15:32:34 +01:00
2022-03-22 15:48:27 +01:00
2022-02-17 08:20:59 +01:00
2022-03-15 15:05:14 +01:00
2022-02-16 15:49:38 +01:00

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
Infrastructure container for analysis container
Readme 3.2 MiB
Release 4.1.0 Latest
2025-01-22 12:38:26 +01:00
Languages
Python 96.7%
Makefile 2%
Shell 1.3%