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
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
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")
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")
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
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()
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()
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 __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()
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()
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])
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)
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))
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))