From 3e4d1ab7b098f29596500b36218778e23b37b312 Mon Sep 17 00:00:00 2001 From: Sunyanan Choochotkaew Date: Thu, 28 Sep 2023 14:53:44 +0900 Subject: [PATCH] fill the case that failed to get output path Signed-off-by: Sunyanan Choochotkaew --- src/estimate/estimator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/estimate/estimator.py b/src/estimate/estimator.py index 21795e9c..09b30d1c 100644 --- a/src/estimate/estimator.py +++ b/src/estimate/estimator.py @@ -58,7 +58,7 @@ def handle_request(data): if output_type.name not in loaded_model: loaded_model[output_type.name] = dict() - + output_path = "" if energy_source not in loaded_model[output_type.name]: output_path = get_download_output_path(download_path, power_request.energy_source, output_type) if not os.path.exists(output_path): @@ -82,8 +82,8 @@ def handle_request(data): model = loaded_model[output_type.name][energy_source] powers, msg = model.get_power(power_request.datapoint) if msg != "": - print("{} fail to predict, removed".format(model.model_name)) - if os.path.exists(output_path): + print("{} fail to predict, removed: {}".format(model.model_name, msg)) + if output_path != "" and os.path.exists(output_path): shutil.rmtree(output_path) return {"powers": powers, "msg": msg}