From: Sandrine Avakian Date: Thu, 9 Jan 2014 16:21:03 +0000 (+0100) Subject: Small fixes in the documentation, test script and iotlabdriver. X-Git-Tag: sfa-3.1-2~36 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=dfbd43817f240359cfb53dd6e87be479837cba32 Small fixes in the documentation, test script and iotlabdriver. --- diff --git a/sfa/cortexlab/docs/source/index.rst b/sfa/cortexlab/docs/source/index.rst index 674125ba..0824fc87 100644 --- a/sfa/cortexlab/docs/source/index.rst +++ b/sfa/cortexlab/docs/source/index.rst @@ -19,10 +19,20 @@ testbeds driver folders. The /cortexlab directory contains the necessary files defining API for LDAP, the postgresql database as well as for the SFA managers. +CortexlabShell +-------------- + +**fill missing code in this class** + +This class contains methods to check reserved nodes, leases and launch/delete +experiments on the testbed. Methods interacting with the testbed have +to be completed. Cortexlabnodes --------------- +**fill missing code in this class** + CortexlabQueryTestbed class's goal is to get information from the testbed about the site and its nodes. There are two types of information about the nodes: diff --git a/sfa/iotlab/iotlabdriver.py b/sfa/iotlab/iotlabdriver.py index 0e0af785..1f571155 100644 --- a/sfa/iotlab/iotlabdriver.py +++ b/sfa/iotlab/iotlabdriver.py @@ -16,10 +16,10 @@ from sfa.managers.driver import Driver from sfa.rspecs.version_manager import VersionManager from sfa.rspecs.rspec import RSpec -from sfa.iotlab.iotlabxrn import IotlabXrn, xrn_object +from sfa.iotlab.iotlabxrn import IotlabXrn, xrn_object, xrn_to_hostname from sfa.util.xrn import Xrn, hrn_to_urn, get_authority, urn_to_hrn from sfa.iotlab.iotlabaggregate import IotlabAggregate -from sfa.iotlab.iotlabxrn import xrn_to_hostname + from sfa.iotlab.iotlabslices import IotlabSlices from sfa.trust.credential import Credential @@ -42,10 +42,11 @@ class IotlabDriver(Driver): """ Sets the iotlab SFA config parameters, - instanciates the testbed api and the iotlab database. + instanciates the testbed api . - :param config: iotlab SFA configuration object - :type config: Config object + :param api: SfaApi configuration object. Holds reference to the + database. + :type api: SfaApi object """ Driver.__init__(self, api) @@ -420,8 +421,6 @@ class IotlabDriver(Driver): return_slicerec_dictlist.append(slicerec_dict) - logger.debug("IOTLAB_API.PY \tGetSlices \ - OHOHOHOH %s" %(return_slicerec_dictlist)) logger.debug("IOTLAB_API.PY \tGetSlices \ slicerec_dict %s return_slicerec_dictlist %s \ @@ -553,7 +552,7 @@ class IotlabDriver(Driver): Two purposes: -Fetch all the jobs from OAR (running, waiting..) complete the reservation information with slice hrn - found in testbed_xp table. If not available in the table, + found in lease_table . If not available in the table, assume it is a iotlab slice. -Updates the iotlab table, deleting jobs when necessary. @@ -642,7 +641,7 @@ class IotlabDriver(Driver): if lease_filter_dict is None: reservation_list = unfiltered_reservation_list - self.update_experiments_in_additional_sfa_db(job_oar_list, jobs_psql_id_list) + self.update_experiments_in_lease_table(job_oar_list, jobs_psql_id_list) logger.debug(" IOTLAB_API.PY \tGetLeases reservation_list %s" % (reservation_list)) @@ -650,9 +649,9 @@ class IotlabDriver(Driver): - def update_experiments_in_additional_sfa_db(self, + def update_experiments_in_lease_table(self, experiment_list_from_testbed, experiment_list_in_db): - """ Cleans the iotlab db by deleting expired and cancelled jobs. + """ Cleans the lease_table by deleting expired and cancelled jobs. Compares the list of experiment ids given by the testbed with the experiment ids that are already in the database, deletes the @@ -671,7 +670,7 @@ class IotlabDriver(Driver): set_experiment_list_in_db = set(experiment_list_in_db) kept_experiments = set(experiment_list_from_testbed).intersection(set_experiment_list_in_db) - logger.debug("\r\n \t update_experiments_in_additional_sfa_db \ + logger.debug("\r\n \t update_experiments_in_lease_table \ experiment_list_in_db %s \r\n \ experiment_list_from_testbed %s \ kept_experiments %s " @@ -685,6 +684,8 @@ class IotlabDriver(Driver): request.filter(LeaseTableXP.experiment_id.in_(deleted_experiments)).delete(synchronize_session='fetch') self.api.dbsession().commit() return + + def AddSlice(self, slice_record, user_record): """ diff --git a/testbeds/iotlab/tests/driver_tests.py b/testbeds/iotlab/tests/driver_tests.py index 1737afa6..77b813b0 100644 --- a/testbeds/iotlab/tests/driver_tests.py +++ b/testbeds/iotlab/tests/driver_tests.py @@ -301,7 +301,7 @@ def TestIotlabDriver(job_id = None): # Iotlabdriver methods slice_hrn = 'iotlab.avakian_slice' - message_and_wait(("\r\n GetSlices slice_hrn"%(slice_hrn))) + message_and_wait(("\r\n GetSlices slice_hrn %s "%(slice_hrn))) sl = iotlabdriver.GetSlices( slice_filter= slice_hrn, slice_filter_type='slice_hrn') print sl