diff --git a/slope-evaluator/Dockerfile b/slope-evaluator/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4d9df3682c15d2de90916c776843d91b9f75474e --- /dev/null +++ b/slope-evaluator/Dockerfile @@ -0,0 +1,7 @@ +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 + +COPY ./app /app +COPY requirements.txt requirements.txt + +COPY requirements.txt requirements.txt +RUN pip install -r requirements.txt \ No newline at end of file diff --git a/slope-evaluator/README.md b/slope-evaluator/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c8bc9dad9e3ee2bcfceee27a0f8bb92ed418623b --- /dev/null +++ b/slope-evaluator/README.md @@ -0,0 +1,26 @@ +# Slope Evaluator + +## Execution + +For development: + +```sh +uvicorn main:app --reload +``` + +Build the docker image: + +```sh +docker build . -t theodolite-evaluator +``` + +Run the Docker image: + +```sh + docker run -p 80:80 -e PORT="9999" theodolite-evaluator +``` + +## Configuration + +You can set the `HOST` and the `PORT` (and a lot of more parameters) via environment variablen. +For more information see [here](https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#advanced-usage). diff --git a/slope-evaluator/api.py b/slope-evaluator/app/main.py similarity index 96% rename from slope-evaluator/api.py rename to slope-evaluator/app/main.py index 3d31c9c096d71494ecef0bf0bcd7b9b1e76f8f5e..47cb5772535157d1ec0c5c5b3458a7f674a48fec 100644 --- a/slope-evaluator/api.py +++ b/slope-evaluator/app/main.py @@ -42,3 +42,5 @@ async def evaluate_slope(request: Request): data = json.loads(await request.body()) logger.info("Request received") return execute(data['total_lag'], data['threshold'],data['warmup']) + +logger.info("Slope evaluator is online") \ No newline at end of file diff --git a/slope-evaluator/trend_slope_computer.py b/slope-evaluator/app/trend_slope_computer.py similarity index 100% rename from slope-evaluator/trend_slope_computer.py rename to slope-evaluator/app/trend_slope_computer.py diff --git a/slope-evaluator/requirements.txt b/slope-evaluator/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca77b6c891136b1388aaf56c5ae269d6ee4b5729 --- /dev/null +++ b/slope-evaluator/requirements.txt @@ -0,0 +1,3 @@ +fastapi==0.55.1 +scikit-learn==0.20.3 +pandas==1.0.3