Merge branch 'senslab2' of ssh://git.f-lab.fr/git/sfa into senslab2
authorNicolas Turro <Nicolas.Turro@inria.fr>
Wed, 28 Mar 2012 14:43:36 +0000 (16:43 +0200)
committerNicolas Turro <Nicolas.Turro@inria.fr>
Wed, 28 Mar 2012 14:43:36 +0000 (16:43 +0200)
Conflicts:
sfa/senslab/slabaggregate.py

sfa/senslab/OARrestapi.py
sfa/senslab/slabaggregate.py
sfa/senslab/slabdriver.py

index 7799f99..fa7e0f9 100644 (file)
@@ -237,9 +237,10 @@ class OARGETParser:
     def ParseJobsTable(self) : 
         print "ParseJobsTable"
                 
-    def ParseJobsDetails (self): 
-       
+    def ParseJobsDetails (self):
+        # currently, this function is not used a lot, so i have no idea what be usefull to parse, returning the full json. NT
         print >>sys.stderr,"ParseJobsDetails %s " %(self.raw_json)
+        return self.raw_json
         
 
     def ParseJobsIds(self):
index ca9c496..f8ce7a3 100644 (file)
@@ -190,7 +190,7 @@ class SlabAggregate:
         #node_tags = self.get_node_tags(tags_filter)
        
         #links = self.get_links(sites_dict, nodes_dict, interfaces)
-        
+        reserved_nodes=self.driver.GetReservedNodes()
         rspec_nodes = []
         for node in nodes:
             # skip whitelisted nodes
@@ -209,8 +209,11 @@ class SlabAggregate:
             # do not include boot state (<available> element) in the manifest rspec
             if not slice:     
                 rspec_node['boot_state'] = node['boot_state']
+                if node['hostname'] in reserved_nodes:
+                    rspec_node['boot_state'] = "Reserved"
             rspec_node['exclusive'] = 'True'
             rspec_node['hardware_types'] = [HardwareType({'name': 'slab-node'})]
+
             # only doing this because protogeni rspec needs
             # to advertise available initscripts 
             #rspec_node['pl_initscripts'] = None
index 87de9d8..3c35164 100644 (file)
@@ -468,7 +468,6 @@ class SlabDriver(Driver):
         #'api_timestamp']
         #assigned_res = ['resource_id', 'resource_uri']
         #assigned_n = ['node', 'node_uri']
-      
      
        if job_id and resources is False:
             req = "GET_jobs_id"
@@ -477,8 +476,6 @@ class SlabDriver(Driver):
         if job_id and resources :
             req = "GET_jobs_id_resources"
             node_list_k = 'reserved_resources' 
-
-      
                
         #Get job info from OAR    
         job_info = self.oar.parser.SendRequest(req, job_id, username)
@@ -498,11 +495,7 @@ class SlabDriver(Driver):
         for node in node_list:
             node_hostname_list.append(node['hostname'])
         node_dict = dict(zip(node_hostname_list,node_list))
-        
-
         try :
-
-
             liste =job_info[node_list_k] 
             print>>sys.stderr, "\r\n \r\n \t\t GetJobs resources  job_info liste%s" %(liste)
             for k in range(len(liste)):
@@ -518,10 +511,14 @@ class SlabDriver(Driver):
         except KeyError:
             print>>sys.stderr, "\r\n \r\n \t\t GetJobs KEYERROR " 
             
-  
-            
-
-       
+    def GetReservedNodes(self):
+        # this function returns a list of all the nodes already involved in an oar job
+
+       jobs=self.oar.parser.SendRequest("GET_jobs_details") 
+       nodes=[]
+       for j in jobs :
+          nodes=j['assigned_network_address']+nodes
+       return nodes
      
     def GetNodes(self,node_filter= None, return_fields=None):