From a1e256366be8952196effdbb41edb615e93a05c5 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 11 Jul 2013 17:09:31 +0200 Subject: [PATCH] Removing now useless attribute db in iotlabdriver. Changing name of create_engine in iotlabpostgres to create_iotlab_engine. Adding forgotten import in importer. --- sfa/importer/iotlabimporter.py | 8 ++++---- sfa/iotlab/iotlabapi.py | 2 +- sfa/iotlab/iotlabdriver.py | 2 +- sfa/iotlab/iotlabpostgres.py | 7 +++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sfa/importer/iotlabimporter.py b/sfa/importer/iotlabimporter.py index f9e39198..0817dad8 100644 --- a/sfa/importer/iotlabimporter.py +++ b/sfa/importer/iotlabimporter.py @@ -2,7 +2,7 @@ from sfa.util.config import Config from sfa.util.xrn import Xrn, get_authority, hrn_to_urn from sfa.iotlab.iotlabdriver import IotlabDriver - +from sfa.iotlab.iotlabpostgres import IotlabDB, Iotlab_xp from sfa.trust.certificate import Keypair, convert_public_key from sfa.trust.gid import create_uuid @@ -495,11 +495,11 @@ class IotlabImporter: config = Config() iotlabdriver = IotlabDriver(config) - + iotlab_db = IotlabDB(config) #Create special slice table for iotlab - if not iotlabdriver.db.exists('iotlab_xp'): - iotlabdriver.db.createtable() + if not iotlab_db.exists('iotlab_xp'): + iotlab_db.createtable() self.logger.info ("IotlabImporter.run: iotlab_xp table created ") diff --git a/sfa/iotlab/iotlabapi.py b/sfa/iotlab/iotlabapi.py index 6a1e5c3f..32776170 100644 --- a/sfa/iotlab/iotlabapi.py +++ b/sfa/iotlab/iotlabapi.py @@ -35,7 +35,7 @@ class IotlabTestbedAPI(): self.ldap = LDAPapi() self.time_format = "%Y-%m-%d %H:%M:%S" self.root_auth = config.SFA_REGISTRY_ROOT_AUTH - self.grain = 1 # 10 mins lease minimum + self.grain = 1 # 10 mins lease minimum, 1 sec granularity #import logging, logging.handlers #from sfa.util.sfalogging import _SfaLogger #sql_logger = _SfaLogger(loggername = 'sqlalchemy.engine', \ diff --git a/sfa/iotlab/iotlabdriver.py b/sfa/iotlab/iotlabdriver.py index 8cdf8507..8f845139 100644 --- a/sfa/iotlab/iotlabdriver.py +++ b/sfa/iotlab/iotlabdriver.py @@ -41,7 +41,7 @@ class IotlabDriver(Driver): Driver.__init__ (self, config) self.config = config - self.db = IotlabDB(config, debug = False) + # self.db = IotlabDB(config, debug = False) self.iotlab_api = IotlabTestbedAPI(config) self.cache = None diff --git a/sfa/iotlab/iotlabpostgres.py b/sfa/iotlab/iotlabpostgres.py index 78f4b210..a35b2c56 100644 --- a/sfa/iotlab/iotlabpostgres.py +++ b/sfa/iotlab/iotlabpostgres.py @@ -77,17 +77,15 @@ class IotlabDB(object): class Singleton: """ Class used with this Python singleton design pattern - @todo Add all variables, and methods needed for the - Singleton class below """ def __init__(self, config, debug = False): self.iotlab_engine = None self.iotlab_session = None - self.create_engine(config, debug) + self.create_iotlab_engine(config, debug) self.session() - def create_engine(self, config, debug = False): + def create_iotlab_engine(self, config, debug = False): if debug == True: @@ -158,6 +156,7 @@ class IotlabDB(object): self.iotlab_session.close() self.iotlab_session = None + def update_jobs_in_iotlabdb(self, job_oar_list, jobs_psql): """ Cleans the iotlab db by deleting expired and cancelled jobs. Compares the list of job ids given by OAR with the job ids that -- 2.43.0