本文整理汇总了Python中bzt.jmx.JMX._get_action_block方法的典型用法代码示例。如果您正苦于以下问题:Python JMX._get_action_block方法的具体用法?Python JMX._get_action_block怎么用?Python JMX._get_action_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bzt.jmx.JMX
的用法示例。
在下文中一共展示了JMX._get_action_block方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compile_set_variables_block
# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_action_block [as 别名]
def compile_set_variables_block(self, block):
# pause current thread for 0s
test_action = JMX._get_action_block(action_index=1, target_index=0, duration_ms=0)
children = etree.Element("hashTree")
fmt = "vars.put('%s', %r);"
block.config["jsr223"] = [{
"language": "groovy",
"execute": "before",
"script-text": "\n".join(fmt % (var, expr) for var, expr in iteritems(block.mapping))
}]
self.__add_jsr_elements(children, block)
return [test_action, children]
示例2: compile_action_block
# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_action_block [as 别名]
def compile_action_block(self, block):
"""
:type block: ActionBlock
:return:
"""
actions = {
'stop': 0,
'pause': 1,
'stop-now': 2,
'continue': 3,
}
targets = {'current-thread': 0, 'all-threads': 2}
action = actions[block.action]
target = targets[block.target]
duration = 0
if block.duration is not None:
duration = int(block.duration * 1000)
test_action = JMX._get_action_block(action, target, duration)
children = etree.Element("hashTree")
self.__add_jsr_elements(children, block)
return [test_action, children]