本文整理汇总了Python中st2common.persistence.trace.Trace.get方法的典型用法代码示例。如果您正苦于以下问题:Python Trace.get方法的具体用法?Python Trace.get怎么用?Python Trace.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.trace.Trace
的用法示例。
在下文中一共展示了Trace.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get
# 需要导入模块: from st2common.persistence.trace import Trace [as 别名]
# 或者: from st2common.persistence.trace.Trace import get [as 别名]
def test_get(self):
saved = TraceDBTest._create_save_trace(
trace_tag='test_trace',
action_executions=[str(bson.ObjectId()) for _ in range(4)],
rules=[str(bson.ObjectId()) for _ in range(4)],
trigger_instances=[str(bson.ObjectId()) for _ in range(5)])
retrieved = Trace.get(id=saved.id)
self.assertEquals(retrieved.id, saved.id, 'Incorrect trace retrieved.')
示例2: test_update_via_list_push
# 需要导入模块: from st2common.persistence.trace import Trace [as 别名]
# 或者: from st2common.persistence.trace.Trace import get [as 别名]
def test_update_via_list_push(self):
no_action_executions = 4
no_rules = 4
no_trigger_instances = 5
saved = TraceDBTest._create_save_trace(
trace_tag='test_trace',
action_executions=[str(bson.ObjectId()) for _ in range(no_action_executions)],
rules=[str(bson.ObjectId()) for _ in range(no_rules)],
trigger_instances=[str(bson.ObjectId()) for _ in range(no_trigger_instances)])
# push updates
Trace.push_action_execution(
saved, action_execution=TraceComponentDB(object_id=str(bson.ObjectId())))
Trace.push_rule(saved, rule=TraceComponentDB(object_id=str(bson.ObjectId())))
Trace.push_trigger_instance(
saved, trigger_instance=TraceComponentDB(object_id=str(bson.ObjectId())))
retrieved = Trace.get(id=saved.id)
self.assertEquals(retrieved.id, saved.id, 'Incorrect trace retrieved.')
self.assertEquals(len(retrieved.action_executions), no_action_executions + 1)
self.assertEquals(len(retrieved.rules), no_rules + 1)
self.assertEquals(len(retrieved.trigger_instances), no_trigger_instances + 1)