From 7443776c7d458cd4ef58965516bbc19f39df84e0 Mon Sep 17 00:00:00 2001 From: Fotis Paraskevopoulos Date: Sun, 26 Sep 2021 09:05:07 +0300 Subject: [PATCH 1/2] MOR-117 Setting the docker name as a variable to make sure it is the same accross --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b20a9b7..7596c028 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,8 @@ variables: SLO_SEVERITY_CALCULATOR_CLI: "mvn --batch-mode -f morphemic-slo-severity-calculator/pom.xml" PREDICTON_ORCHESTRATOR_CLI: "mvn --batch-mode -N -f prediction_orchestrator/pom.xml" + DOCKER_FORECAST_ESHYBRID_DOCKER_NAME: 'morphemic_forecasting_eshybird' + cache: paths: - maven_repo/ @@ -245,8 +247,8 @@ deploy:morphemic-forecasting-eshybrid: - $DOCKER_DIND_SERVICE script: - cd morphemic-forecasting-eshybrid - - docker build -t morphemic-forecasting-eshybird . + - docker build -t $DOCKER_FORECAST_ESHYBRID_DOCKER_NAME . - docker image ls - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin - - docker tag morphemic-forecasting-eshybrid:latest $CI_REGISTRY_IMAGE/morphemic-forecasting-eshybrid:$CI_COMMIT_BRANCH - - docker push $CI_REGISTRY_IMAGE/morphemic-forecasting-eshybrid:$CI_COMMIT_BRANCH + - docker tag $DOCKER_FORECAST_ESHYBRID_DOCKER_NAME:latest $CI_REGISTRY_IMAGE/$DOCKER_FORECAST_ESHYBRID_DOCKER_NAME:$CI_COMMIT_BRANCH + - docker push $CI_REGISTRY_IMAGE/$DOCKER_FORECAST_ESHYBRID_DOCKER_NAME:$CI_COMMIT_BRANCH -- GitLab From ede9a4e5bfb0507aa3a3358ca99dbd86d8166747 Mon Sep 17 00:00:00 2001 From: Fotis Paraskevopoulos Date: Sun, 26 Sep 2021 09:26:34 +0300 Subject: [PATCH 2/2] Correcting logging in order to validate messages, and minor fixes --- morphemic-forecasting-eshybrid/forecasting/eshybrid.py | 4 ++-- morphemic-forecasting-eshybrid/main.py | 8 +++++++- morphemic-forecasting-eshybrid/morphemic/model.py | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/morphemic-forecasting-eshybrid/forecasting/eshybrid.py b/morphemic-forecasting-eshybrid/forecasting/eshybrid.py index 2d554beb..5b94d393 100644 --- a/morphemic-forecasting-eshybrid/forecasting/eshybrid.py +++ b/morphemic-forecasting-eshybrid/forecasting/eshybrid.py @@ -124,7 +124,7 @@ class ESHybrid(morphemic.handler.ModelHandler,messaging.listener.MorphemicListen def on_metrics_to_predict(self,res): - logging.debug("[6] Metrics to predics %s " % res) + logging.debug("[2] Metrics to predics %s " % res) for metric in self.metrics: logging.debug("Un-subscribing from %s " % metric) self.connector.unsubscribe(metric.metric,self.id) @@ -148,7 +148,7 @@ class ESHybrid(morphemic.handler.ModelHandler,messaging.listener.MorphemicListen def on_start_forecasting_eshybrid(self,res): - logging.debug("[6] Start Forecasting %s " % res) + logging.debug("[7] Start Forecasting %s " % res) if not self.metrics: logging.error("Start forecasting before metrics to predict ") diff --git a/morphemic-forecasting-eshybrid/main.py b/morphemic-forecasting-eshybrid/main.py index 99d0136e..dd1e582c 100644 --- a/morphemic-forecasting-eshybrid/main.py +++ b/morphemic-forecasting-eshybrid/main.py @@ -1,13 +1,19 @@ import logging import configparser import os +import argparse from forecasting import eshybrid logger = logging.getLogger() logger.setLevel(logging.DEBUG) -config_file = "%s/%s" % (os.getcwd(), "sync.cfg") +parser = argparse.ArgumentParser(description='Run eshybrid forecaster') +parser.add_argument('--config', help='Config file to run, default sync.cfg') + +args = parser.parse_args() + +config_file = "%s/%s" % (os.getcwd(), args.config or "sync.cfg") print("Config file %s ", config_file) config = configparser.RawConfigParser() config.read(config_file) diff --git a/morphemic-forecasting-eshybrid/morphemic/model.py b/morphemic-forecasting-eshybrid/morphemic/model.py index 2562291e..ea6a730f 100644 --- a/morphemic-forecasting-eshybrid/morphemic/model.py +++ b/morphemic-forecasting-eshybrid/morphemic/model.py @@ -139,5 +139,4 @@ class Model: ret= self._model.model_for_metric(metric).predict(m_pd) - return ret \ No newline at end of file -- GitLab