[haizea-commit] r824 - branches/1.1/src/haizea/core/scheduler
haizea-commit at mailman.cs.uchicago.edu
haizea-commit at mailman.cs.uchicago.edu
Fri Jul 9 16:32:14 CDT 2010
Author: borja
Date: 2010-07-09 16:32:14 -0500 (Fri, 09 Jul 2010)
New Revision: 824
Modified:
branches/1.1/src/haizea/core/scheduler/slottable.py
Log:
Not entirely sure what's the root of this, but when using image transfers the availability window doesn't seem to get properly cached. This fix seems to shave ~30% off the time it takes to run the simulations that involve image transfers.
Modified: branches/1.1/src/haizea/core/scheduler/slottable.py
===================================================================
--- branches/1.1/src/haizea/core/scheduler/slottable.py 2010-07-08 21:55:57 UTC (rev 823)
+++ branches/1.1/src/haizea/core/scheduler/slottable.py 2010-07-09 21:32:14 UTC (rev 824)
@@ -501,8 +501,11 @@
# time is after the existing start time *and* the requested start time is one of
# the changepoints covered by the availability window.
if self.awcache == None or start < self.awcache_time or (start >= self.awcache_time and not self.awcache.changepoints.has_key(start)):
- # If the cached version doesn't work, recompute the availability window
- self.__get_aw_cache_miss(start)
+ if start < self.awcache_time:
+ self.__get_aw_cache_miss(start, include = [self.awcache_time])
+ else:
+ self.__get_aw_cache_miss(start)
+
return self.awcache
def get_availability(self, time, min_capacity=None):
@@ -966,7 +969,7 @@
self.availabilitycache[time] = nodes
- def __get_aw_cache_miss(self, time):
+ def __get_aw_cache_miss(self, time, include = []):
"""Computes availability window at a given time, and caches it.
Called when get_availability_window can't use the cached availability window.
@@ -974,7 +977,7 @@
@param time: Start of availability window.
@type time: L{DateTime}
"""
- self.awcache = AvailabilityWindow(self, time)
+ self.awcache = AvailabilityWindow(self, time, include)
self.awcache_time = time
def __dirty(self):
@@ -1088,7 +1091,7 @@
created through the SlotTable's get_availability_window method.
"""
- def __init__(self, slottable, time):
+ def __init__(self, slottable, time, include):
"""Constructor
An availability window starts at a specific time, provided to the constructor.
@@ -1103,7 +1106,8 @@
self.time = time
self.leases = set()
- self.cp_list = [self.time] + self.slottable.get_changepoints_after(time)
+ self.cp_list = [self.time] + self.slottable.get_changepoints_after(time) + include
+ self.cp_list.sort()
# The availability window is stored using a sparse data structure that
# allows quick access to information related to a specific changepoint in
More information about the Haizea-commit
mailing list