def test_expand_to_seconds_fail(self):
     try:
         tankcore.expand_to_seconds("100n")
         raise RuntimeError("Exception expected")
     except ValueError, ex:
         # it's ok, we have excpected exception
         print ex
Beispiel #2
0
 def test_expand_to_seconds_fail(self):
     try:
         tankcore.expand_to_seconds("100n")
         raise RuntimeError("Exception expected")
     except ValueError, ex:
         # it's ok, we have excpected exception
         print ex
Beispiel #3
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.seconds_count = 0
     self.quantile_hash = ""
     self.seconds_limit = tankcore.expand_to_seconds(
         param_str.split(',')[0])
     self.autostop = autostop
Beispiel #4
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")
Beispiel #5
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.seconds_count = 0
     self.quantile_hash = ""
     self.seconds_limit = tankcore.expand_to_seconds(
         param_str.split(',')[0])
     self.autostop = autostop
Beispiel #6
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")
Beispiel #7
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.seconds_count = 0
     self.quantile = float(param_str.split(',')[0])
     self.rt_limit = tankcore.expand_to_milliseconds(param_str.split(',')[1])
     self.seconds_limit = tankcore.expand_to_seconds(param_str.split(',')[2])
     self.autostop = autostop
Beispiel #8
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.seconds_count = 0
     self.rt_limit = tankcore.expand_to_milliseconds(
         param_str.split(',')[0])
     self.seconds_limit = tankcore.expand_to_seconds(
         param_str.split(',')[1])
     self.autostop = autostop
 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()
Beispiel #10
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()
Beispiel #11
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()
Beispiel #12
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

        level_str = param_str.split(',')[1].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(',')[2])
Beispiel #13
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()
Beispiel #14
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()
Beispiel #15
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()
Beispiel #16
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

        level_str = param_str.split(',')[1].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(',')[2])
 def test_expand_to_seconds(self):
     for i in self.stest:
         self.assertEqual(tankcore.expand_to_seconds(i[0]), i[1])
Beispiel #18
0
 def test_expand_to_seconds(self):
     for i in self.stest:
         self.assertEqual(tankcore.expand_to_seconds(i[0]), i[1])
Beispiel #19
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.start_time = time.time()
     self.end_time = time.time()
     self.time_limit = tankcore.expand_to_seconds(param_str)
Beispiel #20
0
 def __init__(self, autostop, param_str):
     AbstractCriteria.__init__(self)
     self.start_time = time.time()
     self.end_time = time.time()
     self.time_limit = tankcore.expand_to_seconds(param_str)
Beispiel #21
0
 def configure(self):
     self.interval = tankcore.expand_to_seconds(self.get_option("interval", self.interval))
     self.disk_limit = int(self.get_option("disk_limit", self.disk_limit))
     self.mem_limit = int(self.get_option("mem_limit", self.mem_limit))
Beispiel #22
0
 def configure(self):
     self.interval = tankcore.expand_to_seconds(
         self.get_option("interval", self.interval))
     self.disk_limit = int(self.get_option("disk_limit", self.disk_limit))
     self.mem_limit = int(self.get_option("mem_limit", self.mem_limit))