From b54e31f4fd3ddd1490ae92cb04564dfb7d88a853 Mon Sep 17 00:00:00 2001 From: Jose Gracia Date: Fri, 17 Nov 2023 16:24:00 +0100 Subject: [PATCH] Lazy import of sqlalchemy --- monitoring/db/scripts/get_detailed_power.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitoring/db/scripts/get_detailed_power.py b/monitoring/db/scripts/get_detailed_power.py index 023e4ba..7a19e7f 100644 --- a/monitoring/db/scripts/get_detailed_power.py +++ b/monitoring/db/scripts/get_detailed_power.py @@ -1,15 +1,16 @@ -import sqlalchemy as db import numpy as np from collections import OrderedDict import os.path def init_db(): + import sqlalchemy as db _verbose = False #True engine = db.create_engine('postgresql://hpc@hawk-monitor4:5432/coe_mon', echo=_verbose) conn = engine.connect() return conn def init_query(jobid, interval): + import sqlalchemy as db query_string = """with job as ( select job_id, starttime, endtime, nodes from jobs where job_id='{jobid}.hawk-pbs5' ),