本文整理汇总了Python中bkr.server.model.RecipeTask.is_failed方法的典型用法代码示例。如果您正苦于以下问题:Python RecipeTask.is_failed方法的具体用法?Python RecipeTask.is_failed怎么用?Python RecipeTask.is_failed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.RecipeTask
的用法示例。
在下文中一共展示了RecipeTask.is_failed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _do_search
# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import is_failed [as 别名]
def _do_search(self, hidden={}, **kw):
tasks = RecipeTask.query\
.filter(RecipeTask.recipe.has(Recipe.recipeset.has(RecipeSet.job.has(
and_(Job.to_delete == None, Job.deleted == None)))))\
.options(joinedload(RecipeTask.task),
joinedload_all(RecipeTask.results, RecipeTaskResult.logs))
recipe_task_id = kw.get('recipe_task_id')
if recipe_task_id:
if isinstance(recipe_task_id, basestring):
tasks = tasks.filter(RecipeTask.id == recipe_task_id)
elif isinstance(recipe_task_id, list):
tasks = tasks.filter(RecipeTask.id.in_(recipe_task_id))
if 'recipe_id' in kw: #most likely we are coming here from a LinkRemoteFunction in recipe_widgets
tasks = tasks.join(RecipeTask.recipe).filter(Recipe.id == kw['recipe_id'])
hidden = dict(distro_tree=1, system=1)
if kw.get('distro_tree_id'):
tasks = tasks.join(RecipeTask.recipe, Recipe.distro_tree)\
.filter(DistroTree.id == kw.get('distro_tree_id'))
hidden = dict(distro_tree=1)
elif kw.get('distro_id'):
tasks = tasks.join(RecipeTask.recipe, Recipe.distro_tree, DistroTree.distro)\
.filter(Distro.id == kw.get('distro_id'))
if kw.get('task_id'):
try:
tasks = tasks.join('task').filter(Task.id==kw.get('task_id'))
hidden = dict(task = 1,
)
except InvalidRequestError:
return "<div>Invalid data:<br>%r</br></div>" % kw
if kw.get('system_id'):
tasks = tasks.join(RecipeTask.recipe,
Recipe.resource.of_type(SystemResource),
SystemResource.system)\
.filter(System.id == kw.get('system_id'))\
.order_by(RecipeTask.id.desc())
hidden = dict(system=1)
if kw.get('job_id'):
job_id = kw.get('job_id')
if not isinstance(job_id, list):
job_id = [job_id]
tasks = tasks.join('recipe','recipeset','job').filter(Job.id.in_(job_id))
if kw.get('system'):
tasks = tasks.join(RecipeTask.recipe, Recipe.resource)\
.filter(RecipeResource.fqdn.like('%%%s%%' % kw.get('system')))
if kw.get('task'):
# Shouldn't have to do this. This only happens on the LinkRemoteFunction calls
kw['task'] = kw.get('task').replace('%2F','/')
tasks = tasks.filter(RecipeTask.name.like('%s' % kw.get('task').replace('*','%%')))
if kw.get('version'):
tasks = tasks.filter(RecipeTask.version.like(kw.get('version').replace('*', '%')))
if kw.get('distro'):
tasks = tasks.join(RecipeTask.recipe, Recipe.distro_tree, DistroTree.distro)\
.filter(Distro.name.like('%%%s%%' % kw.get('distro')))
if kw.get('arch_id'):
tasks = tasks.join(RecipeTask.recipe, Recipe.distro_tree, DistroTree.arch)\
.filter(Arch.id == kw.get('arch_id'))
if kw.get('status'):
tasks = tasks.filter(RecipeTask.status == kw['status'])
if kw.get('is_failed'):
tasks = tasks.filter(RecipeTask.is_failed())
elif kw.get('result'):
tasks = tasks.filter(RecipeTask.result == kw['result'])
if kw.get('osmajor_id'):
tasks = tasks.join(RecipeTask.recipe, Recipe.distro_tree,
DistroTree.distro, Distro.osversion, OSVersion.osmajor)\
.filter(OSMajor.id == kw.get('osmajor_id'))
if kw.get('whiteboard'):
tasks = tasks.join('recipe').filter(Recipe.whiteboard==kw.get('whiteboard'))
return dict(tasks = tasks,
hidden = hidden,
task_widget = self.task_widget)