From ac75b5922029661e97dd0e1a08df991329d11e9d Mon Sep 17 00:00:00 2001 From: Nick Harder <56074305+nick-harder@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:54:30 +0200 Subject: [PATCH] Fix outputs function (#208) -rl params were not written when not in learning -should be for eval -error handling was wrong --------- Co-authored-by: Florian Maurer --- assume/common/outputs.py | 3 +++ assume/common/units_operator.py | 1 + assume/world.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/assume/common/outputs.py b/assume/common/outputs.py index 7d45f22c..42b4dba0 100644 --- a/assume/common/outputs.py +++ b/assume/common/outputs.py @@ -359,6 +359,9 @@ async def on_stop(self): df = pd.read_sql(query, self.db) except (OperationalError, ProgrammingError): continue + except Exception as e: + logger.error("could not read query: %s", e) + continue dfs.append(df) diff --git a/assume/common/units_operator.py b/assume/common/units_operator.py index 952ec4a0..b2dafa96 100644 --- a/assume/common/units_operator.py +++ b/assume/common/units_operator.py @@ -397,6 +397,7 @@ def write_learning_to_output(self, start: datetime, marketconfig: MarketConfig): db_aid = self.context.data_dict.get("learning_output_agent_id") db_addr = self.context.data_dict.get("learning_output_agent_addr") + if db_aid and db_addr: self.context.schedule_instant_acl_message( receiver_id=db_aid, diff --git a/assume/world.py b/assume/world.py index 2fb01889..1a0066c8 100644 --- a/assume/world.py +++ b/assume/world.py @@ -234,6 +234,8 @@ def add_unit_operator( unit_operator_agent._role_context.data_dict = { "output_agent_addr": self.output_agent_addr[0], "output_agent_id": self.output_agent_addr[1], + "learning_output_agent_addr": self.output_agent_addr[0], + "learning_output_agent_id": self.output_agent_addr[1], } async def async_add_unit(