Skip to content

Commit

Permalink
Merge pull request #173 from sunya-ch/estimator
Browse files Browse the repository at this point in the history
fill the case that failed to get output path
  • Loading branch information
rootfs authored Sep 29, 2023
2 parents 7e4e716 + 3e4d1ab commit 549ca42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/estimate/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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}

Expand Down

0 comments on commit 549ca42

Please sign in to comment.