Skip to content

Commit 549ca42

Browse files
authored
Merge pull request #173 from sunya-ch/estimator
fill the case that failed to get output path
2 parents 7e4e716 + 3e4d1ab commit 549ca42

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/estimate/estimator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def handle_request(data):
5858

5959
if output_type.name not in loaded_model:
6060
loaded_model[output_type.name] = dict()
61-
61+
output_path = ""
6262
if energy_source not in loaded_model[output_type.name]:
6363
output_path = get_download_output_path(download_path, power_request.energy_source, output_type)
6464
if not os.path.exists(output_path):
@@ -82,8 +82,8 @@ def handle_request(data):
8282
model = loaded_model[output_type.name][energy_source]
8383
powers, msg = model.get_power(power_request.datapoint)
8484
if msg != "":
85-
print("{} fail to predict, removed".format(model.model_name))
86-
if os.path.exists(output_path):
85+
print("{} fail to predict, removed: {}".format(model.model_name, msg))
86+
if output_path != "" and os.path.exists(output_path):
8787
shutil.rmtree(output_path)
8888
return {"powers": powers, "msg": msg}
8989

0 commit comments

Comments
 (0)