diff --git a/monitoring/db/scripts/get_detailed_power.py b/monitoring/db/scripts/get_detailed_power.py index 5128539..7e4c819 100644 --- a/monitoring/db/scripts/get_detailed_power.py +++ b/monitoring/db/scripts/get_detailed_power.py @@ -54,9 +54,12 @@ class Power: return cls -# @classmethod -# def from_db(cls, db): - + @classmethod + def from_db(cls, db, jobid, interval): + all_list = db.db_to_list(jobid, interval) + + return Power.from_list(all_list) + def to_file(self, jobid): """Dumps power data to file. Returns filename is succesfull and None if unsucessfull.""" @@ -186,9 +189,8 @@ if __name__ == "__main__": config.interval = 5 DB = MonitoringDB(config.verbose) - all_list = DB.db_to_list(config.jobid, config.interval) - power = Power.from_list(all_list) + power = Power.from_db(DB, config.jobid, config.interval) #print("#epochs", len(power.epochs)) # #print(power.header())