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

haizea-commit at mailman.cs.uchicago.edu haizea-commit at mailman.cs.uchicago.edu
Tue Jan 19 15:47:39 CST 2010


Author: borja
Date: 2010-01-19 15:47:38 -0600 (Tue, 19 Jan 2010)
New Revision: 780

Modified:
   branches/1.1/src/haizea/core/scheduler/vm_scheduler.py
Log:
When scheduling as soon as possible, don't bother to look at changepoints that don't allow the deadline to be met.

Modified: branches/1.1/src/haizea/core/scheduler/vm_scheduler.py
===================================================================
--- branches/1.1/src/haizea/core/scheduler/vm_scheduler.py	2010-01-18 04:02:29 UTC (rev 779)
+++ branches/1.1/src/haizea/core/scheduler/vm_scheduler.py	2010-01-19 21:47:38 UTC (rev 780)
@@ -499,6 +499,8 @@
             changepoints.sort()
             changepoints = [(x, onlynodes) for x in changepoints]
 
+        if lease.deadline != None:
+            changepoints = [cp for cp in changepoints if cp[0] <= lease.deadline - duration]
 
         # If we can schedule VMs in the future,
         # we also consider future changepoints
@@ -519,6 +521,9 @@
             
         futurecp.sort()
 
+        if lease.deadline != None:
+            futurecp = [cp for cp in futurecp if cp[0] <= lease.deadline - duration]
+
         #
         # STEP 3: FIND A MAPPING
         #
@@ -567,7 +572,10 @@
             # makes a request that could *never* be satisfied with the
             # current resources.
             if start == None:
-                raise InconsistentScheduleError, "Could not find a mapping in the future (this should not happen)"
+                if lease.deadline != None:
+                    raise NotSchedulableException, "Could not find enough resources for this request before deadline"
+                else:
+                    raise InconsistentScheduleError, "Could not find a mapping in the future (this should not happen)"
 
             in_future = True
 
@@ -644,7 +652,11 @@
                 else:
                     return vmrr, preemptions
         else:
-            vmrr, preemptions = self.__schedule_asap(lease, duration, nexttime, earliest, allow_in_future = True, override_state=override_state)
+            try:
+                vmrr, preemptions = self.__schedule_asap(lease, duration, nexttime, earliest, allow_in_future = True, override_state=override_state)
+            except NotSchedulableException:
+                vmrr = None
+                preemptions = []
 
         if vmrr == None or vmrr.end - vmrr.start != duration or vmrr.end > lease.deadline or len(preemptions)>0:
             self.logger.debug("Lease #%i cannot be scheduled before deadline using best-effort." % lease.id)



More information about the Haizea-commit mailing list