[haizea-commit] r775 - branches/1.1/src/haizea/core/scheduler

haizea-commit at mailman.cs.uchicago.edu haizea-commit at mailman.cs.uchicago.edu
Fri Jan 15 19:43:11 CST 2010


Author: borja
Date: 2010-01-15 19:43:11 -0600 (Fri, 15 Jan 2010)
New Revision: 775

Modified:
   branches/1.1/src/haizea/core/scheduler/lease_scheduler.py
   branches/1.1/src/haizea/core/scheduler/vm_scheduler.py
Log:
Lists of reservations returned by the slottable have to be sorted before they can be used.

Modified: branches/1.1/src/haizea/core/scheduler/lease_scheduler.py
===================================================================
--- branches/1.1/src/haizea/core/scheduler/lease_scheduler.py	2010-01-15 23:22:47 UTC (rev 774)
+++ branches/1.1/src/haizea/core/scheduler/lease_scheduler.py	2010-01-16 01:43:11 UTC (rev 775)
@@ -491,6 +491,7 @@
                 self.__schedule_lease(l, nexttime)
 
         future_vmrrs = self.slottable.get_reservations_on_or_after(nexttime)
+        future_vmrrs.sort(key=attrgetter("start"))        
         future_vmrrs = [rr for rr in future_vmrrs 
                         if isinstance(rr, VMResourceReservation) 
                         and rr.lease.get_type() == Lease.DEADLINE
@@ -887,8 +888,8 @@
             try:
                 # Kludge: so scheduler will schedule taking into account the remaining
                 # duration at the time of the preempt, not right now.
-                orig_accduration = lease.duration.accumulated
-                lease.duration.accumulated = lease.duration.requested - dur
+                #orig_accduration = lease.duration.accumulated
+                #lease.duration.accumulated = lease.duration.requested - dur
                 
                 if lease_to_preempt.id in cancelled:
                     last_vmrr = lease_to_preempt.get_last_vmrr()
@@ -906,7 +907,7 @@
                         earliest[node] = EarliestStartingTime(preemption_time, EarliestStartingTime.EARLIEST_NOPREPARATION)                
                     (new_vmrr, preemptions) = self.vm_scheduler.reschedule_deadline(lease_to_preempt, dur, nexttime, earliest, override_state = Lease.STATE_SUSPENDED_PENDING)
 
-                lease.duration.accumulated = orig_accduration
+                #lease.duration.accumulated = orig_accduration
     
                 # Add VMRR to lease
                 lease_to_preempt.append_vmrr(new_vmrr)

Modified: branches/1.1/src/haizea/core/scheduler/vm_scheduler.py
===================================================================
--- branches/1.1/src/haizea/core/scheduler/vm_scheduler.py	2010-01-15 23:22:47 UTC (rev 774)
+++ branches/1.1/src/haizea/core/scheduler/vm_scheduler.py	2010-01-16 01:43:11 UTC (rev 775)
@@ -514,6 +514,7 @@
         else:
             futurecp = []
             
+        futurecp.sort()
 
         #
         # STEP 3: FIND A MAPPING
@@ -649,6 +650,7 @@
             dirtytime = earliest_time
 
             future_vmrrs = self.slottable.get_reservations_on_or_after(earliest_time)
+            future_vmrrs.sort(key=operator.attrgetter("start"))
             future_vmrrs = [rr for rr in future_vmrrs 
                             if isinstance(rr, VMResourceReservation) 
                             and rr.state == ResourceReservation.STATE_SCHEDULED
@@ -713,14 +715,14 @@
             
             # We've scheduled the lease. Now we try to schedule the rest of the leases but,
             # since now we know the nodes the new lease is in, we can do a few optimizations
-            
             # Restore the leases in nodes we haven't used, and that would not be
             # affected by the new lease. We need to find what this set of nodes is.
             
             to_schedule = [l for l in leases if l not in scheduled]
             dirtynodes, cleanleases = self.find_dirty_nodes(to_schedule, dirtynodes, orig_vmrrs)
+            self.logger.debug("Rescheduling only leases on nodes %s" % dirtynodes)
+            self.logger.debug("Leases %s can be skipped" % [l.id for l in cleanleases])
             
-            
             print "Ignoring %i nodes" % (len(set(self.slottable.nodes.keys()) - dirtynodes) - 1)
 
             # Restore the leases



More information about the Haizea-commit mailing list