本文整理汇总了Python中bkr.server.model.Job.record_activity方法的典型用法代码示例。如果您正苦于以下问题:Python Job.record_activity方法的具体用法?Python Job.record_activity怎么用?Python Job.record_activity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.Job
的用法示例。
在下文中一共展示了Job.record_activity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flash
# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import record_activity [as 别名]
except InvalidRequestError:
flash(_(u"Invalid job id %s" % id))
redirect(".")
if not job.can_cancel(identity.current.user):
flash(_(u"You don't have permission to cancel job id %s" % id))
redirect(".")
try:
job.cancel(msg)
except StaleTaskStatusException, e:
log.warn(str(e))
session.rollback()
flash(_(u"Could not cancel job id %s. Please try later" % id))
redirect(".")
else:
job.record_activity(user=identity.current.user, service=u'WEBUI',
field=u'Status', action=u'Cancelled', old='', new='')
flash(_(u"Successfully cancelled job %s" % id))
redirect('/jobs/mine')
@identity.require(identity.not_anonymous())
@expose(template="bkr.server.templates.form")
def cancel(self, id):
"""
Confirm cancel job
"""
try:
job = Job.by_id(id)
except InvalidRequestError:
flash(_(u"Invalid job id %s" % id))
redirect(".")
if not job.can_cancel(identity.current.user):