Removing now useless attribute db in iotlabdriver.
authorSandrine Avakian <sandrine.avakian@inria.fr>
Thu, 11 Jul 2013 15:09:31 +0000 (17:09 +0200)
committerSandrine Avakian <sandrine.avakian@inria.fr>
Thu, 11 Jul 2013 15:09:31 +0000 (17:09 +0200)
Changing name of create_engine in iotlabpostgres to create_iotlab_engine.
Adding forgotten import in importer.

sfa/importer/iotlabimporter.py
sfa/iotlab/iotlabapi.py
sfa/iotlab/iotlabdriver.py
sfa/iotlab/iotlabpostgres.py

index f9e3919..0817dad 100644 (file)
@@ -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 ")
 
 
index 6a1e5c3..3277617 100644 (file)
@@ -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', \
index 8cdf850..8f84513 100644 (file)
@@ -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
 
index 78f4b21..a35b2c5 100644 (file)
@@ -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