示例#1
0
	def __init__ (self):
		reader = InputReader()
		self.resourceCaps = reader.readCapacityFile()
		self.vmResourceRequirement = reader.readVMConfigFile()
		self.appsList = reader.readAppInfo()
		self.nVM = len(self.vmResourceRequirement)
		Scheduler.packedAppsForEachAvgSysLoad = {}
示例#2
0
 def __init__(self):
     reader = InputReader()
     self.resourceCaps = reader.readCapacityFile()
     self.vmResourceRequirement = reader.readVMConfigFile()
     self.appsList = reader.readAppInfo()
     self.nVM = len(self.vmResourceRequirement)
     Scheduler.packedAppsForEachAvgSysLoad = {}
示例#3
0
        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)
		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)