本文整理汇总了Python中st2common.persistence.executionstate.ActionExecutionState.add_or_update方法的典型用法代码示例。如果您正苦于以下问题:Python ActionExecutionState.add_or_update方法的具体用法?Python ActionExecutionState.add_or_update怎么用?Python ActionExecutionState.add_or_update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.executionstate.ActionExecutionState
的用法示例。
在下文中一共展示了ActionExecutionState.add_or_update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_state_models
# 需要导入模块: from st2common.persistence.executionstate import ActionExecutionState [as 别名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import add_or_update [as 别名]
def _update_state_models(cls):
states = ResultsTrackerTests.states
state1 = ActionExecutionState.get_by_id(states['state1.yaml'].id)
state1.execution_id = ResultsTrackerTests.liveactions['liveaction1.yaml'].id
state2 = ActionExecutionState.get_by_id(states['state2.yaml'].id)
state2.execution_id = ResultsTrackerTests.liveactions['liveaction2.yaml'].id
ResultsTrackerTests.states['state1.yaml'] = ActionExecutionState.add_or_update(state1)
ResultsTrackerTests.states['state2.yaml'] = ActionExecutionState.add_or_update(state2)
示例2: setup_query
# 需要导入模块: from st2common.persistence.executionstate import ActionExecutionState [as 别名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import add_or_update [as 别名]
def setup_query(liveaction_id, runnertype_db, query_context):
if not getattr(runnertype_db, 'query_module', None):
raise Exception('The runner "%s" does not have a query module.' % runnertype_db.name)
state_db = ActionExecutionStateDB(
execution_id=liveaction_id,
query_module=runnertype_db.query_module,
query_context=query_context
)
ActionExecutionState.add_or_update(state_db)
示例3: _create_execution_state
# 需要导入模块: from st2common.persistence.executionstate import ActionExecutionState [as 别名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import add_or_update [as 别名]
def _create_execution_state(self, liveaction_id, runnertype_db, query_context):
state_db = ActionExecutionStateDB(
execution_id=liveaction_id, query_module=runnertype_db.query_module, query_context=query_context
)
try:
return ActionExecutionState.add_or_update(state_db)
except:
LOG.exception("Unable to create execution state db for liveaction_id %s." % liveaction_id)
return None
示例4: _create_save_actionstate
# 需要导入模块: from st2common.persistence.executionstate import ActionExecutionState [as 别名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import add_or_update [as 别名]
def _create_save_actionstate():
created = ActionExecutionStateDB()
created.query_context = {'id': 'some_external_service_id'}
created.query_module = 'dummy.modules.query1'
created.execution_id = bson.ObjectId()
return ActionExecutionState.add_or_update(created)
示例5: get_state
# 需要导入模块: from st2common.persistence.executionstate import ActionExecutionState [as 别名]
# 或者: from st2common.persistence.executionstate.ActionExecutionState import add_or_update [as 别名]
def get_state(cls, exec_db):
state = ActionExecutionStateDB(execution_id=str(exec_db.id), query_context={'id': 'foo'},
query_module='test_querymodule')
return ActionExecutionState.add_or_update(state)