def __init__ (self): reader = InputReader() self.resourceCaps = reader.readCapacityFile() self.vmResourceRequirement = reader.readVMConfigFile() self.appsList = reader.readAppInfo() self.nVM = len(self.vmResourceRequirement) Scheduler.packedAppsForEachAvgSysLoad = {}
def __init__(self): reader = InputReader() self.resourceCaps = reader.readCapacityFile() self.vmResourceRequirement = reader.readVMConfigFile() self.appsList = reader.readAppInfo() self.nVM = len(self.vmResourceRequirement) Scheduler.packedAppsForEachAvgSysLoad = {}
nUser = len(bundles) self.init(nUser) self.calculateRelevanceFactor(resourceCaps) self.calculateRequiredResource(bundles, vmResourceRequirement, resourceCaps) self.calculateSigmaMetric(bids) self.sortUser(k, deadlines) orderedKUserIDs = self.U[:k] welfare, winnerLoser = self.allocate(resourceCaps, bids, k) return orderedKUserIDs, welfare, winnerLoser ''' To test the mechanism ''' if __name__ == '__main__': reader = InputReader() k = 2 bundles, runtimes, bids, deadlines = reader.readRequestFile() resourceCaps = reader.readCapacityFile() vmResourceRequirement = reader.readVMConfigFile() alloactor = KTimeSensitiveResourceAllocator() #alloactor.calculateRelevanceFactor(resourceCaps) #alloactor.calculateRequiredResource(bundles, vmResourceRequirement) #alloactor.calculateOurAnotherMetric(bids) alloactor.sortUserOnDeadline(k, deadlines) #alloactor.allocate(resourceCaps, bids)