本文整理汇总了Python中st2common.persistence.runner.RunnerType.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python RunnerType.get_by_id方法的具体用法?Python RunnerType.get_by_id怎么用?Python RunnerType.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.runner.RunnerType
的用法示例。
在下文中一共展示了RunnerType.get_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __get_by_id
# 需要导入模块: from st2common.persistence.runner import RunnerType [as 别名]
# 或者: from st2common.persistence.runner.RunnerType import get_by_id [as 别名]
def __get_by_id(id):
try:
return RunnerType.get_by_id(id)
except (ValueError, ValidationError) as e:
msg = 'Database lookup for id="%s" resulted in exception. %s' % (id, e)
LOG.exception(msg)
abort(http_client.NOT_FOUND, msg)
示例2: get_runnertype_by_id
# 需要导入模块: from st2common.persistence.runner import RunnerType [as 别名]
# 或者: from st2common.persistence.runner.RunnerType import get_by_id [as 别名]
def get_runnertype_by_id(runnertype_id):
"""
Get RunnerType by id.
On error, raise StackStormDBObjectNotFoundError
"""
try:
runnertype = RunnerType.get_by_id(runnertype_id)
except (ValueError, ValidationError) as e:
LOG.warning('Database lookup for runnertype with id="%s" resulted in ' "exception: %s", runnertype_id, e)
raise StackStormDBObjectNotFoundError("Unable to find runnertype with " 'id="%s"' % runnertype_id)
return runnertype