本文整理汇总了Python中tankcore.expand_to_seconds函数的典型用法代码示例。如果您正苦于以下问题:Python expand_to_seconds函数的具体用法?Python expand_to_seconds怎么用?Python expand_to_seconds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expand_to_seconds函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_expand_to_seconds_fail
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
开发者ID:svetlyak40wt,项目名称:yandex-tank,代码行数:7,代码来源:CommonUtilsTest.py
示例2: __init__
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")
开发者ID:SpeCT,项目名称:yandex-tank,代码行数:27,代码来源:Phantom.py
示例3: configure
def configure(self):
self.config = self.get_option("config", "auto").strip()
self.default_target = self.get_option("default_target", "localhost")
self.monitoring.ssh_timeout = tankcore.expand_to_seconds(self.get_option("ssh_timeout", "5s"))
if self.config == "none" or self.config == "auto":
self.die_on_fail = False
else:
if self.config[0] == "<":
xmlfile = self.core.mkstemp(".xml", "monitoring_")
self.core.add_artifact_file(xmlfile)
xml = open(xmlfile, "w")
xml.write(self.config)
xml.close()
self.config = xmlfile
if not os.path.exists(self.config):
raise OSError("Monitoring config file not found: %s" % self.config)
if self.config == "none":
self.monitoring = None
if self.config == "auto":
self.config = os.path.dirname(__file__) + "/monitoring_default_config.xml"
try:
autostop = self.core.get_plugin_of_type(AutostopPlugin)
autostop.add_criteria_class(MetricHigherCriteria)
autostop.add_criteria_class(MetricLowerCriteria)
except KeyError:
self.log.debug("No autostop plugin found, not adding instances criteria")
开发者ID:denistimofeev,项目名称:yandex-tank,代码行数:31,代码来源:Monitoring.py
示例4: load_step
def load_step(start, end, step, duration,):
'''
Stepping load pattern
'''
dur = tankcore.expand_to_seconds(duration)
(steps, loads, total) = ([], '', 0)
if end > start:
for rps_level in range(start, end + 1, step):
steps.append([rps_level, dur])
loads += '%s,step,%s,%s,(%s,%s,%s,%s)\n' % (
dur,
rps_level,
rps_level,
start,
end,
step,
duration,
)
total += rps_level * dur
else:
for rps_level in range(start, end - 1, -step):
steps.append([rps_level, dur])
loads += '%s,step,%s,%s,(%s,%s,%s,%s)\n' % (
dur,
rps_level,
rps_level,
start,
end,
step,
duration,
)
total += rps_level * dur
return [steps, loads, total]
开发者ID:euroelessar,项目名称:yandex-tank,代码行数:33,代码来源:Stepper.py
示例5: load_line
def load_line(start, end, duration):
'''
Linear load pattern
'''
dur = tankcore.expand_to_seconds(duration)
diff_k = float((end - start) / float(dur - 1))
(cnt, last_x, total) = (1, start, 0)
loads = '%s,line,%s,%s,(%s,%s,%s)\n' % (
dur,
start,
end,
start,
end,
duration,
)
steps = []
for sec_i in range(1, dur + 1):
cur_x = int(start + diff_k * sec_i)
if cur_x == last_x:
cnt += 1
else:
steps.append([last_x, cnt])
total += cnt * last_x
(cnt, last_x) = (1, cur_x)
return [steps, loads, total]
开发者ID:euroelessar,项目名称:yandex-tank,代码行数:25,代码来源:Stepper.py
示例6: __init__
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
开发者ID:pr0n1x,项目名称:yandex-tank,代码行数:7,代码来源:Autostop.py
示例7: __init__
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()
开发者ID:wd5,项目名称:yandex-tank,代码行数:9,代码来源:TotalAutostop.py
示例8: load_const
def load_const(req, duration):
"""
Constant load pattern
"""
dur = tankcore.expand_to_seconds(duration)
steps = []
steps.append([req, dur])
loads = "%s,const,%s,%s,(%s,%s)\n" % (dur, req, req, req, duration)
time = dur * int(req)
if int(req) == 0:
time = dur
return [steps, loads, time]
开发者ID:angelina666,项目名称:yandex-tank,代码行数:12,代码来源:Stepper.py
示例9: __init__
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()
开发者ID:angelina666,项目名称:yandex-tank,代码行数:14,代码来源:TotalAutostop.py
示例10: __init__
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
开发者ID:denistimofeev,项目名称:yandex-tank,代码行数:18,代码来源:Monitoring.py
示例11: constf
def constf(req, duration):
"""
Float const load pattern
"""
pattern = re.match("(\d+)\/(\d+)", req)
if pattern:
(a, b) = (int(pattern.group(1)), int(pattern.group(2)))
(dur, e) = (tankcore.expand_to_seconds(duration), int(a / b))
fract = "%.3f" % (float(a) / b)
loads = "%s,const,%s,%s,(%s,%s)\n" % (dur, fract, fract, req, duration)
a = a % b
req = "%s/%s" % (a, b)
out = []
tail = dur % b
for x in range(1, int(dur / b) + 1):
out += frps(req)
if tail:
out += frps_cut(tail, req)
if e > 0:
out = frps_expand(out, e)
return (out, loads, frps_ammo(out))
else:
raise RuntimeError("Error in 'const_f' function. rps: %s, duration: %s" % (req, duration))
开发者ID:angelina666,项目名称:yandex-tank,代码行数:24,代码来源:Stepper.py
示例12: __init__
def __init__(self, autostop, param_str):
AbstractCriteria.__init__(self)
self.seconds_count = 0
self.hash = ""
self.seconds_limit = tankcore.expand_to_seconds(param_str.split(',')[0])
self.autostop = autostop
开发者ID:Mprint,项目名称:yandex-tank,代码行数:6,代码来源:Autostop.py
示例13: test_expand_to_seconds
def test_expand_to_seconds(self):
for i in self.stest:
self.assertEqual(tankcore.expand_to_seconds(i[0]), i[1])
开发者ID:svetlyak40wt,项目名称:yandex-tank,代码行数:3,代码来源:CommonUtilsTest.py
示例14: configure
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))
开发者ID:greggyNapalm,项目名称:yandex-tank,代码行数:4,代码来源:ResourceCheck.py
示例15: configure
def configure(self):
self.port = int(self.get_option("port", self.port))
self.interval = int(tankcore.expand_to_seconds(self.get_option("interval", '1m')))
self.redirect = self.get_option("redirect", self.redirect)
self.manual_stop = int(self.get_option('manual_stop', self.manual_stop))
开发者ID:greggyNapalm,项目名称:yandex-tank,代码行数:5,代码来源:WebOnline.py
注:本文中的tankcore.expand_to_seconds函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论