Skip to content

Commit

Permalink
Merge pull request #492 from assume-framework/fix_no_db_with_rl
Browse files Browse the repository at this point in the history
fix missing database check when doing RL without a given database
  • Loading branch information
kim-mskw authored Nov 21, 2024
2 parents 18a8b62 + fe85a55 commit b0aed76
Show file tree
Hide file tree
Showing 2 changed files with 4 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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ classifiers=[
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10"
dependencies = [
Expand Down

0 comments on commit b0aed76

Please sign in to comment.