Intercept empty query resutls

This commit is contained in:
Jose Gracia 2024-02-21 14:58:35 +01:00
parent c2b5732be8
commit 711daa3a5d

View file

@ -84,6 +84,8 @@ class Power:
@classmethod @classmethod
def from_db(cls, db, jobid, interval, hawk_ai): def from_db(cls, db, jobid, interval, hawk_ai):
df = db.db_to_pf(jobid, interval, hawk_ai) df = db.db_to_pf(jobid, interval, hawk_ai)
if df.empty:
raise RuntimeError
power = cls.from_pandas(df, {'time': 'time', 'name': 'node', 'avg': 'power'}) power = cls.from_pandas(df, {'time': 'time', 'name': 'node', 'avg': 'power'})
return power return power