[haizea-commit] r795 - in branches/1.1/src/haizea/core: . scheduler

haizea-commit at mailman.cs.uchicago.edu haizea-commit at mailman.cs.uchicago.edu
Tue May 18 17:17:51 CDT 2010


Author: borja
Date: 2010-05-18 17:17:51 -0500 (Tue, 18 May 2010)
New Revision: 795

Modified:
   branches/1.1/src/haizea/core/leases.py
   branches/1.1/src/haizea/core/scheduler/slottable.py
Log:
Fixed bug in creation of resource tuples with multi-instance resources where the original Capacity object doesn't specify a value for the multi-instance resource.

Modified: branches/1.1/src/haizea/core/leases.py
===================================================================
--- branches/1.1/src/haizea/core/leases.py	2010-05-18 21:40:16 UTC (rev 794)
+++ branches/1.1/src/haizea/core/leases.py	2010-05-18 22:17:51 UTC (rev 795)
@@ -1698,7 +1698,7 @@
                     r.set_quantity(res_type, amount)
                 else:
                     instances = res.findall("instance")
-                    r.set_ninstances(type, len(instances))
+                    r.set_ninstances(res_type, len(instances))
                     for i, instance in enumerate(instances):
                         amount = int(instance.get("amount"))
                         r.set_quantity_instance(res_type, i+1, amount)

Modified: branches/1.1/src/haizea/core/scheduler/slottable.py
===================================================================
--- branches/1.1/src/haizea/core/scheduler/slottable.py	2010-05-18 21:40:16 UTC (rev 794)
+++ branches/1.1/src/haizea/core/scheduler/slottable.py	2010-05-18 22:17:51 UTC (rev 795)
@@ -466,7 +466,7 @@
         @rtype: L{ResourceTuple}        
         """    
         single_instance = [0] * self.rtuple_nsingle
-        multi_instance = {}
+        multi_instance = dict([(pos,[]) for pos in xrange(self.rtuple_nsingle, self.rtuple_nsingle+self.rtuple_nmultiple)])
         for restype in capacity.get_resource_types():
             pos = self.rtuple_restype2pos[restype]
             ninst = capacity.ninstances[restype]



More information about the Haizea-commit mailing list