本文整理汇总了Python中st2common.persistence.liveaction.LiveAction.publish_update方法的典型用法代码示例。如果您正苦于以下问题:Python LiveAction.publish_update方法的具体用法?Python LiveAction.publish_update怎么用?Python LiveAction.publish_update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.liveaction.LiveAction
的用法示例。
在下文中一共展示了LiveAction.publish_update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_action_results
# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import publish_update [as 别名]
def _update_action_results(self, execution_id, status, results):
liveaction_db = LiveAction.get_by_id(execution_id)
if not liveaction_db:
raise Exception('No DB model for liveaction_id: %s' % execution_id)
liveaction_db.result = results
liveaction_db.status = status
# update liveaction, update actionexecution and then publish update.
updated_liveaction = LiveAction.add_or_update(liveaction_db, publish=False)
executions.update_execution(updated_liveaction)
LiveAction.publish_update(updated_liveaction)
return updated_liveaction
示例2: _update_action_results
# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import publish_update [as 别名]
def _update_action_results(self, execution_id, status, results):
liveaction_db = LiveAction.get_by_id(execution_id)
if not liveaction_db:
raise Exception('No DB model for liveaction_id: %s' % execution_id)
liveaction_db.result = results
liveaction_db.status = status
done = status in DONE_STATES
if done and not liveaction_db.end_timestamp:
# Action has completed, record end_timestamp
liveaction_db.end_timestamp = date_utils.get_datetime_utc_now()
# update liveaction, update actionexecution and then publish update.
updated_liveaction = LiveAction.add_or_update(liveaction_db, publish=False)
executions.update_execution(updated_liveaction)
LiveAction.publish_update(updated_liveaction)
return updated_liveaction
示例3: _update_action_results
# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import publish_update [as 别名]
def _update_action_results(self, execution_id, status, results):
liveaction_db = LiveAction.get_by_id(execution_id)
if not liveaction_db:
raise Exception("No DB model for liveaction_id: %s" % execution_id)
if liveaction_db.status != action_constants.LIVEACTION_STATUS_CANCELED:
liveaction_db.status = status
liveaction_db.result = results
# Action has completed, record end_timestamp
if liveaction_db.status in action_constants.LIVEACTION_COMPLETED_STATES and not liveaction_db.end_timestamp:
liveaction_db.end_timestamp = date_utils.get_datetime_utc_now()
# update liveaction, update actionexecution and then publish update.
updated_liveaction = LiveAction.add_or_update(liveaction_db, publish=False)
executions.update_execution(updated_liveaction)
LiveAction.publish_update(updated_liveaction)
return updated_liveaction