diff --git a/assume/common/outputs.py b/assume/common/outputs.py index 8e683b98..872cd056 100644 --- a/assume/common/outputs.py +++ b/assume/common/outputs.py @@ -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 @@ -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.