Skip to content

Commit

Permalink
run delete_similar_runs not before on_ready
Browse files Browse the repository at this point in the history
the database engine is not created before this part
  • Loading branch information
maurerle committed Dec 10, 2024
1 parent e74788d commit 06eabbf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions assume/common/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ def __init__(
self.learning_mode = learning_mode
self.perform_evaluation = perform_evaluation

# get episode number if in learning or evaluation mode
self.episode = None
if self.learning_mode or self.perform_evaluation:
episode = self.simulation_id.split("_")[-1]
if episode.isdigit():
self.episode = int(episode)

# check if episode=0 and delete all similar runs
if self.episode == 0:
self.delete_similar_runs()

# construct all timeframe under which hourly values are written to excel and db
self.start = start
self.end = end
Expand Down Expand Up @@ -217,6 +206,17 @@ def on_ready(self):
# this should not wait for the task to finish to block the simulation
)

# get episode number if in learning or evaluation mode
self.episode = None
if self.learning_mode or self.perform_evaluation:
episode = self.simulation_id.split("_")[-1]
if episode.isdigit():
self.episode = int(episode)

# check if episode=0 and delete all similar runs
if self.episode == 0:
self.delete_similar_runs()

def handle_output_message(self, content: dict, meta: MetaDict):
"""
Handles the incoming messages and performs corresponding actions.
Expand Down

0 comments on commit 06eabbf

Please sign in to comment.