def randomizeProperty(self, nodeName, propertyName, associatedData=None): """ Randomizes a property for a given node, returning its new value """ # the following machines will have poor health if nodeName in self.badMachines: if propertyName == "health": return normalizeValue(self.nodeState[nodeName][propertyName] + self.badNodeHealthDelta[associatedData['severity']]) elif propertyName == "memoryUsage": return normalizeValue(self.nodeState[nodeName][propertyName] + getRandomElement(self.badNodeMemoryDelta)) if propertyName == "memoryUsage": return normalizeValue(self.nodeState[nodeName][propertyName] + numpy.random.normal(loc=-0.025, scale=0.05)) return RandomSimulator.randomizeProperty(self, nodeName, propertyName, associatedData)
def randomizeProperty(self, nodeName, propertyName, associatedData=None): """ Randomizes a property for a given node, returning its new value """ # rack1 will have low CPU & memory utilization if propertyName == "cpuUsage" and "machine1" in nodeName: return normalizeValue(self.nodeState[nodeName][propertyName] + getRandomElement(self.lowCpuUsageDelta)) # rack3 will have high CPU utilization elif propertyName == "cpuUsage" and "machine3" in nodeName: return normalizeValue(self.nodeState[nodeName][propertyName] + getRandomElement(self.highCpuUsageDelta)) if propertyName == "contextSwitchRate": return normalizeValue(self.nodeState[nodeName]["cpuUsage"] + numpy.random.normal(loc=0, scale=0.10)) else: return RandomSimulator.randomizeProperty(self, nodeName, propertyName, associatedData)
def randomizeProperty(self, nodeName, propertyName, associatedData=None): """ Randomizes a property for a given node, returning its new value """ if propertyName == 'predictedSeverityProbabilities': return { 'FATAL' : normalizeValue(self.nodeState[nodeName]['predictedSeverityProbabilities']['FATAL'] + getRandomElement(self.deltaMap['predictedFatal'])), 'ERROR': normalizeValue(self.nodeState[nodeName]['predictedSeverityProbabilities']['ERROR'] + getRandomElement(self.deltaMap['predictedError'])), 'WARN': normalizeValue(self.nodeState[nodeName]['predictedSeverityProbabilities']['WARN'] + getRandomElement(self.deltaMap['predictedWarn'])), 'INFO': normalizeValue(self.nodeState[nodeName]['predictedSeverityProbabilities']['INFO'] + getRandomElement(self.deltaMap['predictedInfo'])) } elif propertyName == 'health': return normalizeValue(self.nodeState[nodeName]['health'] + self.deltaMap['health'][associatedData['severity']]) else: return normalizeValue(self.nodeState[nodeName][propertyName] + getRandomElement(self.deltaMap[propertyName]))