當前位置: 首頁>>代碼示例>>Python>>正文


Python ActionExecutionState.get_all方法代碼示例

本文整理匯總了Python中st2common.persistence.executionstate.ActionExecutionState.get_all方法的典型用法代碼示例。如果您正苦於以下問題:Python ActionExecutionState.get_all方法的具體用法?Python ActionExecutionState.get_all怎麽用?Python ActionExecutionState.get_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在st2common.persistence.executionstate.ActionExecutionState的用法示例。


在下文中一共展示了ActionExecutionState.get_all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_state_db_created_for_polling_async_actions

# 需要導入模塊: from st2common.persistence.executionstate import ActionExecutionState [as 別名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import get_all [as 別名]
    def test_state_db_created_for_polling_async_actions(self):
        runner_container = get_runner_container()

        params = {
            'actionstr': 'foo',
            'actionint': 20,
            'async_test': True
        }

        liveaction_db = self._get_liveaction_model(
            RunnerContainerTest.polling_async_action_db,
            params
        )

        liveaction_db = LiveAction.add_or_update(liveaction_db)
        executions.create_execution_object(liveaction_db)

        # Assert that execution ran without exceptions.
        runner_container.dispatch(liveaction_db)
        states = ActionExecutionState.get_all()
        found = [state for state in states if state.execution_id == liveaction_db.id]

        self.assertTrue(len(found) > 0, 'There should be a state db object.')
        self.assertTrue(len(found) == 1, 'There should only be one state db object.')
        self.assertTrue(found[0].query_context is not None)
        self.assertTrue(found[0].query_module is not None)
開發者ID:lyandut,項目名稱:st2,代碼行數:28,代碼來源:test_runner_container.py

示例2: test_state_db_creation_async_actions

# 需要導入模塊: from st2common.persistence.executionstate import ActionExecutionState [as 別名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import get_all [as 別名]
    def test_state_db_creation_async_actions(self):
        runner_container = get_runner_container()
        params = {"actionstr": "foo", "actionint": 20, "async_test": True}
        liveaction_db = self._get_action_exec_db_model(RunnerContainerTest.async_action_db, params)
        liveaction_db = LiveAction.add_or_update(liveaction_db)
        executions.create_execution_object(liveaction_db)
        # Assert that execution ran without exceptions.
        runner_container.dispatch(liveaction_db)
        states = ActionExecutionState.get_all()

        found = None
        for state in states:
            if state.execution_id == liveaction_db.id:
                found = state
        self.assertTrue(found is not None, "There should be a state db object.")
        self.assertTrue(found.query_context is not None)
        self.assertTrue(found.query_module is not None)
開發者ID:emptywee,項目名稱:st2,代碼行數:19,代碼來源:test_runner_container.py

示例3: _bootstrap

# 需要導入模塊: from st2common.persistence.executionstate import ActionExecutionState [as 別名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import get_all [as 別名]
    def _bootstrap(self):
        all_states = ActionExecutionState.get_all()
        LOG.info('Found %d pending states in db.' % len(all_states))

        query_contexts_dict = defaultdict(list)
        for state_db in all_states:
            try:
                context = QueryContext.from_model(state_db)
            except:
                LOG.exception('Invalid state object: %s', state_db)
                continue
            query_module_name = state_db.query_module
            querier = self.get_querier(query_module_name)

            if querier is not None:
                query_contexts_dict[querier].append(context)

        for querier, contexts in six.iteritems(query_contexts_dict):
            LOG.info('Found %d pending actions for query module %s', len(contexts), querier)
            querier.add_queries(query_contexts=contexts)
開發者ID:AlexeyDeyneko,項目名稱:st2,代碼行數:22,代碼來源:resultstracker.py


注:本文中的st2common.persistence.executionstate.ActionExecutionState.get_all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。