Skip to content

Commit

Permalink
finalised app
Browse files Browse the repository at this point in the history
  • Loading branch information
chr2022-anonymous-repository committed Aug 9, 2023
1 parent b95da43 commit 0d73c18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
19 changes: 14 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
# A Dockerisable Version of SABIO

## Contents
## contents


- [`data/`](./data/):
- [`src/`](./src/):
- [`cache/`](./cache/):

- [`start.sh`](./start.sh): see [Running](#running) below
- [`start.sh`](./start.sh): see [running](#running) below

- [`requirements.txt`](./requirements.txt) - list of versioned Python packages used by the SABIO Flask app (file autogenerated by [pigar](https://github.com/damnever/pigar)); slight exception: gunicorn, the WSGI used to spawn Python backend Flask apps


## Installation
## installation

Once the required Python packages are installed, this folder can be run as-is; specifically [`./src/app.py`](./src/app.py) which is the Flask app or [`./start.sh`](./start.sh) which uses gunicorn to run the Flask app.

## Running
## running

some notes:

- each worker spawned (e.g. by `gunicorn`) occupies the same amount of RAM
- running the SABIO backend Flask app has been tested with `gunicorn` as a load balancer and WSGI apps, see [`start.sh`](./start.sh) but it's not necessary to use `gunicorn`; the parameters used in [`start.sh`](./start.sh) are:

- imports in the Python scripts & modules are relative and paths to files in `./cache` and `./data` hard-coded. This implies that `./src/app.py` ca only be run from `./src`.

- each spawned worker (e.g. by `gunicorn`) occupies the same amount of RAM, there is no sharing of resources (due to the Python GIL)

-

-
13 changes: 3 additions & 10 deletions docker/src/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# import sys
# print(sys.path)
# sys.path.insert(0, "/home/valentin/Desktop/SABIO_docker/src/")
# print(sys.path)



from tqdm import tqdm
tqdm.pandas()
import json
Expand All @@ -23,7 +16,7 @@

app = flask.Flask(__name__)
# !!! comment out for production !!!
app.config["DEBUG"] = True
# app.config["DEBUG"] = True

from datasets import NMvW, OpenBeelden
from results import Result
Expand Down Expand Up @@ -283,8 +276,8 @@ def get_examples():
return jsonify({"examples": examples})


if __name__ == "__main__":
app.run(debug=True)
# if __name__ == "__main__":
# app.run(debug=True)



Expand Down

0 comments on commit 0d73c18

Please sign in to comment.