Skip to content

Commit

Permalink
manager: fix "unknown resources cleanup" traceback
Browse files Browse the repository at this point in the history
When a new on-demand pool is configured in pools.yaml, the cleanup logic
is typically executed before a new resource is started there, and thus
also before the database entry is created.

Fixes: #128
Fixes: #115
  • Loading branch information
praiskup committed Nov 6, 2023
1 parent ea0a475 commit de133c4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resallocserver/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,11 @@ def _clean_unknown_resources(self, event):

with session_scope() as session:
dbinfo = session.query(models.Pool).get(self.name)
if not dbinfo:
app.log.warning(
"Can not perform cleanup in the configured "
"pool %s: no such pool in SQL database.", self.name)
return
last_cleanup = dbinfo.cleaning_unknown_resources
if last_cleanup is None:
last_cleanup = datetime.min
Expand Down

0 comments on commit de133c4

Please sign in to comment.