def __init__(self, machineNames): """ constructor """ RandomSimulator.__init__(self, machineNames) self.badMachines = ["machine1-3", "machine2-6", "machine2-7", "machine3-1"] self.badNodeHealthDelta = { } for name in self.deltaMap['health']: self.badNodeHealthDelta[name] = self.deltaMap['health'][name] self.badNodeMemoryDelta = numpy.random.normal(loc=0.02, scale=0.05, size=1000) self.weightedMachineNamesList = deepcopy(self.machineNames) for name in self.badMachines: for i in xrange(0,3): self.weightedMachineNamesList.append(name) self.weightedSeverities = deepcopy(self.severities) for i in xrange(0,4): self.weightedSeverities.append("FATAL") for i in xrange(0,3): self.weightedSeverities.append("ERROR") self.weightedFacilities = deepcopy(self.facilities) for i in xrange(0,4): self.weightedFacilities.append("KERNEL")
def __init__(self, machineNames): """ constructor """ self.lowCpuUsageDelta = numpy.random.normal(loc=-0.025, scale=0.05, size=1000) self.highCpuUsageDelta = numpy.random.normal(loc=0.025, scale=0.05, size=1000) RandomSimulator.__init__(self, machineNames)
def __init__(self, machineNames, taskName, time): RandomSimulator.__init__(self, []) self.taskName = taskName numberOfMapJobs = 10 self.map = [] for i in xrange(0, numberOfMapJobs): mapJob = { 'id': i, 'name': "%s%s%d" % (self.taskName, "-mapJob", i), 'start': time + 0, 'duration': int(numpy.random.normal(loc=60, scale=5)), 'location': getRandomElement(machineNames) } if mapJob['duration'] <= 0: mapJob['duration'] = 1 mapJob['end'] = int(mapJob['start'] + mapJob['duration']) self.map.append(mapJob) numberOfReduceJobs = 10 self.reduce = [] for i in xrange(0, numberOfReduceJobs): reduceJob = { 'id': numberOfMapJobs + i, 'name': "%s%s%d" % (self.taskName, "-reduceJob", i), 'start': time + int(numpy.random.normal(loc=60, scale=5)), 'duration': int(numpy.random.normal(loc=60, scale=5)), 'location': getRandomElement(machineNames) } if reduceJob['duration'] <= 0: reduceJob['duration'] = 1 reduceJob['end'] = int(reduceJob['start'] + reduceJob['duration']) self.reduce.append(reduceJob) self.time = time