예제 #1
0
	def reInit(self, avgSystemLoad):
		self.currentRequestPool = []
		self.waitingRequestPool = []
		self.exitRequestPool = []
		self.missedRequestPool = []
		reader = InputReader()
		self.resourceCaps = reader.readCapacityFile()
예제 #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
 def reInit(self, avgSystemLoad):
     self.currentRequestPool = []
     self.waitingRequestPool = []
     self.exitRequestPool = []
     self.missedRequestPool = []
     reader = InputReader()
     self.resourceCaps = reader.readCapacityFile()
예제 #4
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 = {}
예제 #5
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)