diff --git a/forecasting_gluonts/docker_image/run_gluonts.sh b/forecasting_gluonts/docker_image/run_gluonts.sh index f2be2058d4ec930910b81d2e89d0fceda09b51e4..ddb2a4ca23564249586902ac3c0ec85525f8ec67 100644 --- a/forecasting_gluonts/docker_image/run_gluonts.sh +++ b/forecasting_gluonts/docker_image/run_gluonts.sh @@ -2,8 +2,7 @@ sudo docker rmi -f $(sudo docker images) # Build the image from dockerfile and clone the latest version of my code -sudo docker build . -t gitlab.ow2.org:4567/melodic/morphemic-preprocessor/gluonmachines:morphemic-rc1.5 - +docker build -t gitlab.ow2.org:4567/melodic/morphemic-preprocessor/gluonmachines:morphemic-rc1.5 -f ./forecasting_gluonts/docker_image/Dockerfile . # Test the image #sudo docker run -it --env-file variables.env gitlab.ow2.org:4567/melodic/morphemic-preprocessor/gluonmachines:morphemic-rc1.5 diff --git a/forecasting_gluonts/gluonts_forecaster.py b/forecasting_gluonts/gluonts_forecaster.py index 600e03492ec69af88374040ff4503cd27ebadfda..52bc3e0517ecf34bbe1bc70f49c5ebd2936f7e26 100644 --- a/forecasting_gluonts/gluonts_forecaster.py +++ b/forecasting_gluonts/gluonts_forecaster.py @@ -39,7 +39,11 @@ directory_path = "/morphemic_project/" def train(metric): + data_file_path = os.path.join(os.environ.get("DATA_PATH", "./"), f'{os.environ.get("APP_NAME", "demo")}.csv') + #while (not os.path.isfile(data_file_path)): + #sleep(30) + #logging.debug("Waiting for dataset to be loaded") dataset = pd.read_csv(data_file_path) gluonts_dataset = pd.DataFrame(columns=['ds', 'y']) diff --git a/forecasting_gluonts/gluonts_listener.py b/forecasting_gluonts/gluonts_listener.py index adfa37aa8c695553b67c4d146fddbbb3ba750bf0..cb6f3c42ef0ac08b0e2d345e4dcca8472a055641 100644 --- a/forecasting_gluonts/gluonts_listener.py +++ b/forecasting_gluonts/gluonts_listener.py @@ -40,6 +40,10 @@ def worker(self,body,metric): epoch_start= body["epoch_start"] predictionTimes[metric] = epoch_start + while (not os.path.isfile(directory_path+'models/gluonts_'+metric+".pkl")): + sleep(30) + logging.debug("Waiting for the trained model for metric: " + metric) + while(True): #if flags[metric] == 0: #epoch_start = predictionTimes[metric] @@ -134,6 +138,10 @@ class Gluonts(morphemic.handler.ModelHandler,messaging.listener.MorphemicListene def on_metrics_to_predict(self, body): dataset_preprocessor = CSVData(APP_NAME) dataset_preprocessor.prepare_csv() + data_file_path = os.path.join(os.environ.get("DATA_PATH", "./"), f'{os.environ.get("APP_NAME", "demo")}.csv') + while (not os.path.isfile(data_file_path)): + sleep(30) + logging.debug("Waiting for dataset to be loaded") logging.debug("DATASET DOWNLOADED") for r in body: diff --git a/forecasting_prophet/docker_image/run_prophet.sh b/forecasting_prophet/docker_image/run_prophet.sh index 26314ffdaeec053218b34d2e9e8a095d553b5570..fd152d14dd14da1422724bc1dc33782ae903e531 100644 --- a/forecasting_prophet/docker_image/run_prophet.sh +++ b/forecasting_prophet/docker_image/run_prophet.sh @@ -2,7 +2,8 @@ sudo docker rmi -f $(sudo docker images) # Build the image from dockerfile and clone the latest version of my code -sudo docker build . -t gitlab.ow2.org:4567/melodic/morphemic-preprocessor/prophet:morphemic-rc1.5 +docker build -t gitlab.ow2.org:4567/melodic/morphemic-preprocessor/prophet:morphemic-rc1.5 -f ./forecasting_prophet/docker_image/Dockerfile . + # Test the image #sudo docker run -it --env-file variables.env gitlab.ow2.org:4567/melodic/morphemic-preprocessor/prophet:morphemic-rc1.5 @@ -12,4 +13,3 @@ sudo docker login gitlab.ow2.org:4567 sudo docker push gitlab.ow2.org:4567/melodic/morphemic-preprocessor/prophet:morphemic-rc1.5 - diff --git a/forecasting_prophet/prophet_listener.py b/forecasting_prophet/prophet_listener.py index 3bb822b88f10d1e95b7d3038097ed970cca27fb7..d4aa0443e87e3db25731d8108a6a7e8dc8541c03 100644 --- a/forecasting_prophet/prophet_listener.py +++ b/forecasting_prophet/prophet_listener.py @@ -45,8 +45,9 @@ def worker(self,body,metric): predictionTimes[metric] = epoch_start messages=list() f=0 - if os.path.isfile(directory_path+'models/prophet_'+metric+".pkl"): - logging.debug("Loading the trained model for metric: " + metric) + while (not os.path.isfile(directory_path+'models/prophet_'+metric+".pkl")): + sleep(30) + logging.debug("Waiting for the trained model for metric: " + metric) while(True): #if flags[metric] == 0: @@ -136,6 +137,10 @@ class Prophet(morphemic.handler.ModelHandler,messaging.listener.MorphemicListene #getting data from datasetmaker dataset_preprocessor = CSVData(APP_NAME) dataset_preprocessor.prepare_csv() + data_file_path = os.path.join(os.environ.get("DATA_PATH", "./"), f'{os.environ.get("APP_NAME", "demo")}.csv') + while (not os.path.isfile(data_file_path)): + sleep(30) + logging.debug("Waiting for dataset to be loaded") logging.debug("DATASET DOWNLOADED") for r in body: