Merge branch 'geni-v3' of ssh://git.onelab.eu/git/sfa into geni-v3
fsaintma [Wed, 10 Jun 2015 07:23:47 +0000 (09:23 +0200)]
sfa/iotlab/iotlabdriver.py

index 231ed06..f2c9a26 100644 (file)
@@ -144,20 +144,24 @@ class IotLabDriver(Driver):
         leases = rspec.version.get_leases()
         start_time = min([int(lease['start_time'])
                          for lease in leases])
-        # ASAP Jobs
+        # ASAP jobs
         if start_time == 0:
             start_time = None
-        end_time = max([int(lease['start_time']) +
-                       int(lease['duration'])*60
-                       for lease in leases])
+            duration = max([int(lease['duration'])
+                            for lease in leases])
+        # schedule jobs
+        else:
+            end_time = max([int(lease['start_time']) +
+                            int(lease['duration'])*60
+                            for lease in leases])
+            from math import floor
+            # minutes
+            duration = floor((end_time - start_time)/60)
         nodes_list = [Xrn.unescape(Xrn(lease['component_id'].strip(),
                       type='node').get_leaf())
                       for lease in leases]
         # uniq hostnames
         nodes_list = list(set(nodes_list))
-        from math import floor
-        # minutes
-        duration = floor((end_time - start_time)/60)
         return nodes_list, start_time, duration
 
     def _save_db_lease(self, job_id, slice_hrn):