Lazy import of sqlalchemy

This commit is contained in:
Jose Gracia 2023-11-17 16:24:00 +01:00
parent 3d52b1b2c7
commit b54e31f4fd

View file

@ -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'
),