From f73a60e0abc9b981f44aab833b55682dd78a733e Mon Sep 17 00:00:00 2001 From: Michael Butt Date: Wed, 9 Aug 2023 10:14:26 -0400 Subject: [PATCH] switch to tram-private in docker-compose temporarily MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * establish “pickles” directory to separate pickle files from models to avoid any overwrite issues * add a few additional exclusions to dockerignore --- .dockerignore | 3 +++ data/pickles/.gitkeep | 0 docker/docker-compose.yml | 4 ++-- src/tram/ml/base.py | 2 +- src/tram/settings.py | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 data/pickles/.gitkeep diff --git a/.dockerignore b/.dockerignore index cb2a376c16..b37ccbf0fe 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,8 @@ # exclude items not needed/conflict on docker image +.git +.idea +.DS_Store .github venv .venv diff --git a/data/pickles/.gitkeep b/data/pickles/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3a86c9afd5..1bc6ebeb6c 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,7 +9,7 @@ version: '3.5' services: tram: - image: ghcr.io/center-for-threat-informed-defense/tram:latest + image: ghcr.io/center-for-threat-informed-defense/tram-private:swfarnsworth-bert-django-container-buildable environment: - DATA_DIRECTORY=/tram/data - ALLOWED_HOSTS=["example_host1", "localhost"] @@ -20,7 +20,7 @@ services: - tram:/tram/data - tram_static:/tram/src/tram/staticfiles nginx: - image: ghcr.io/center-for-threat-informed-defense/tram-nginx:latest + image: ghcr.io/center-for-threat-informed-defense/tram-private-nginx:swfarnsworth-bert-django-container-buildable ports: - "8000:80" volumes: diff --git a/src/tram/ml/base.py b/src/tram/ml/base.py index 786b99260d..c03046d306 100644 --- a/src/tram/ml/base.py +++ b/src/tram/ml/base.py @@ -527,7 +527,7 @@ def run_model(self, run_forever=False): time.sleep(1) def get_model_filepath(self, model_class): - filepath = settings.ML_MODEL_DIR + "/" + model_class.__name__ + ".pkl" + filepath = settings.PICKLE_DIR + "/" + model_class.__name__ + ".pkl" return filepath def train_model(self): diff --git a/src/tram/settings.py b/src/tram/settings.py index b3023838ca..49893a6a9c 100644 --- a/src/tram/settings.py +++ b/src/tram/settings.py @@ -225,5 +225,6 @@ } ML_MODEL_DIR = os.path.join(DATA_DIRECTORY, "ml-models") +PICKLE_DIR = os.path.join(DATA_DIRECTORY, "pickles") DEFAULT_AUTO_FIELD = "django.db.models.AutoField"