当前位置: 首页>>代码示例>>Python>>正文


Python LiveAction.get_all方法代码示例

本文整理汇总了Python中st2common.persistence.liveaction.LiveAction.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python LiveAction.get_all方法的具体用法?Python LiveAction.get_all怎么用?Python LiveAction.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在st2common.persistence.liveaction.LiveAction的用法示例。


在下文中一共展示了LiveAction.get_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_liveaction_gets_deleted

# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import get_all [as 别名]
    def test_liveaction_gets_deleted(self):
        now = date_utils.get_datetime_utc_now()
        start_ts = now - timedelta(days=15)
        end_ts = now - timedelta(days=14)

        liveaction_model = copy.deepcopy(self.models['liveactions']['liveaction4.yaml'])
        liveaction_model['start_timestamp'] = start_ts
        liveaction_model['end_timestamp'] = end_ts
        liveaction_model['status'] = action_constants.LIVEACTION_STATUS_SUCCEEDED
        liveaction = LiveAction.add_or_update(liveaction_model)

        # Write one execution before cut-off threshold
        exec_model = copy.deepcopy(self.models['executions']['execution1.yaml'])
        exec_model['start_timestamp'] = start_ts
        exec_model['end_timestamp'] = end_ts
        exec_model['status'] = action_constants.LIVEACTION_STATUS_SUCCEEDED
        exec_model['id'] = bson.ObjectId()
        exec_model['liveaction']['id'] = str(liveaction.id)
        ActionExecution.add_or_update(exec_model)

        liveactions = LiveAction.get_all()
        executions = ActionExecution.get_all()
        self.assertEqual(len(liveactions), 1)
        self.assertEqual(len(executions), 1)

        purge_executions(logger=LOG, timestamp=now - timedelta(days=10))

        liveactions = LiveAction.get_all()
        executions = ActionExecution.get_all()
        self.assertEqual(len(executions), 0)
        self.assertEqual(len(liveactions), 0)
开发者ID:lyandut,项目名称:st2,代码行数:33,代码来源:test_purge_executions.py

示例2: test_invalid_trace_id_provided

# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import get_all [as 别名]
    def test_invalid_trace_id_provided(self):
        liveactions = LiveAction.get_all()
        self.assertEqual(len(liveactions), 1)  # fixtures loads it.
        self.traceable_liveaction['context']['trace_context'] = {'id_': 'balleilaka'}

        self.assertRaises(TraceNotFoundException, action_services.request,
                          self.traceable_liveaction)

        # Make sure no liveactions are left behind
        liveactions = LiveAction.get_all()
        self.assertEqual(len(liveactions), 0)
开发者ID:StackStorm,项目名称:st2,代码行数:13,代码来源:test_trace_injection_action_services.py


注:本文中的st2common.persistence.liveaction.LiveAction.get_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。