Skip to content

Commit

Permalink
fix missing database check when doing RL without a given database
Browse files Browse the repository at this point in the history
This fixes commands like:
assume -s example_02a -c tiny
  • Loading branch information
maurerle committed Nov 21, 2024
1 parent ef325c0 commit d9cc220
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assume/common/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,9 @@ def get_sum_reward(self):
query = text(
f"select unit, SUM(reward) FROM rl_params where simulation='{self.simulation_id}' GROUP BY unit"
)

with self.db.begin() as db:
rewards_by_unit = db.execute(query).fetchall()
if self.db is not None:
with self.db.begin() as db:
rewards_by_unit = db.execute(query).fetchall()

# convert into a numpy array
rewards_by_unit = [r[1] for r in rewards_by_unit]
Expand Down

0 comments on commit d9cc220

Please sign in to comment.