示例#1
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        self.seconds_count = 0
        self.autostop = autostop
        self.threads_limit = 1

        level_str = param_str.split(',')[0].strip()
        if level_str[-1:] == '%':
            self.level = float(level_str[:-1]) / 100
            self.is_relative = True
        else:
            self.level = int(level_str)
            self.is_relative = False
        self.seconds_limit = tankcore.expand_to_seconds(
            param_str.split(',')[1])

        try:
            phantom = autostop.core.get_plugin_of_type(PhantomPlugin)
            info = phantom.get_info()
            if info:
                self.threads_limit = info.instances
            if not self.threads_limit:
                raise ValueError(
                    "Cannot create 'instances' criteria with zero instances limit")
        except KeyError:
            self.log.warning(
                "No phantom module, 'instances' autostop disabled")
示例#2
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        self.seconds_count = 0
        self.autostop = autostop

        level_str = param_str.split(',')[0].strip()
        if level_str[-1:] == '%':
            self.level = float(level_str[:-1]) / 100
            self.is_relative = True
        else:
            self.level = int(level_str)
            self.is_relative = False
        self.seconds_limit = tankcore.expand_to_seconds(
            param_str.split(',')[1])

        try:
            phantom = autostop.core.get_plugin_of_type(PhantomPlugin)
            self.threads_limit = phantom.phantom.instances
            if not self.threads_limit:
                raise ValueError(
                    "Cannot create 'instances' criteria with zero instances limit"
                )
        except KeyError:
            self.log.warning(
                "No phantom module, 'instances' autostop disabled")
示例#3
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     param = param_str.split(',')
     self.seconds_count = 0
     self.rt_limit = tankcore.expand_to_milliseconds(param[0])
     self.frac = param[1][:-1]
     self.seconds_limit = tankcore.expand_to_seconds(param[2])
     self.autostop = autostop
     self.data = deque()
示例#4
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     param = param_str.split(',')
     self.seconds_count = 0
     self.rt_limit = tankcore.expand_to_milliseconds(param[0])
     self.frac = param[1][:-1]
     self.seconds_limit = tankcore.expand_to_seconds(param[2])
     self.autostop = autostop
     self.data = deque()
     self.second_window = deque()
     self.real_frac = float()
示例#5
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        self.seconds_count = 0
        self.codes_mask = param_str.split(',')[0].lower()
        self.codes_regex = re.compile(self.codes_mask.replace("x", '.'))
        self.autostop = autostop
        self.tangents = deque()
        self.second_window = deque()
        self.total_tan = float()

        self.tangents.append(0)
        self.last = 0
        self.seconds_limit = tankcore.expand_to_seconds(param_str.split(',')[1])
        self.measurement_error = float()
示例#6
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        self.seconds_count = 0
        self.codes_mask = param_str.split(',')[0].lower()
        self.codes_regex = re.compile(self.codes_mask.replace("x", '.'))
        self.autostop = autostop
        self.tangents = deque()
        self.second_window = deque()
        self.total_tan = float()

        self.tangents.append(0)
        self.last = 0
        self.seconds_limit = tankcore.expand_to_seconds(param_str.split(',')[1])
        self.measurement_error = float()
示例#7
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        self.autostop = autostop
        self.data = deque()
        self.second_window = deque()

        params = param_str.split(',')
        # qunatile in ms
        self.quantile = tankcore.expand_to_milliseconds(params[0])
        # width of time in seconds
        self.width = tankcore.expand_to_seconds(params[1])
        # max height of deviations in percents
        self.height = float(params[2][0:-1])
        # last deviation in percents
        self.deviation = float()
示例#8
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        self.autostop = autostop
        self.data = deque()
        self.second_window = deque()

        params = param_str.split(',')
        # qunatile in ms
        self.timing = tankcore.expand_to_milliseconds(params[0])
        # width of time in seconds
        self.width = tankcore.expand_to_seconds(params[1])
        # max height of deviations in percents
        self.height = float(params[2].split('%')[0])
        # last deviation in percents
        self.deviation = float()
示例#9
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.seconds_count = 0
     self.codes_mask = param_str.split(',')[0].lower()
     self.codes_regex = re.compile(self.codes_mask.replace("x", '.'))
     self.autostop = autostop
     self.data = deque()
     
     level_str = param_str.split(',')[1].strip()
     if level_str[-1:] == '%':
         self.level = float(level_str[:-1])
         self.is_relative = True
     else:
         self.level = int(level_str)
         self.is_relative = False
     self.seconds_limit = tankcore.expand_to_seconds(param_str.split(',')[2])
示例#10
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.seconds_count = 0
     self.codes_mask = param_str.split(',')[0].lower()
     self.codes_regex = re.compile(self.codes_mask.replace("x", '.'))
     self.autostop = autostop
     self.data = deque()
     self.second_window = deque()
     
     level_str = param_str.split(',')[1].strip()
     if level_str[-1:] == '%':
         self.level = float(level_str[:-1])
         self.is_relative = True
     else:
         self.level = int(level_str)
         self.is_relative = False
     self.seconds_limit = tankcore.expand_to_seconds(param_str.split(',')[2])
示例#11
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        MonitoringDataDecoder.__init__(self)

        try:
            self.mon = autostop.core.get_plugin_of_type(MonitoringPlugin)
            self.mon.monitoring.add_listener(self)
        except KeyError:
            self.log.warning("No monitoring module, mon autostop disabled")
        self.triggered = False
        self.autostop = autostop

        self.host = param_str.split(",")[0].strip()
        self.metric = param_str.split(",")[1].strip()
        self.value_limit = float(param_str.split(",")[2])
        self.seconds_limit = tankcore.expand_to_seconds(param_str.split(",")[3])
        self.last_second = None
        self.seconds_count = 0
示例#12
0
    def __init__(self, autostop, param_str):
        AbstractCriteria.__init__(self)
        MonitoringDataDecoder.__init__(self)

        try:
            self.mon = autostop.core.get_plugin_of_type(MonitoringPlugin)
            self.mon.monitoring.add_listener(self)
        except KeyError:
            self.log.warning("No monitoring module, mon autostop disabled")
        self.triggered = False
        self.autostop = autostop

        self.host = param_str.split(',')[0].strip()
        self.metric = param_str.split(',')[1].strip()
        self.value_limit = float(param_str.split(',')[2])
        self.seconds_limit = tankcore.expand_to_seconds(
            param_str.split(',')[3])
        self.last_second = None
        self.seconds_count = 0