当前位置: 首页>>代码示例>>Python>>正文


Python RecipeTask.is_failed方法代码示例

本文整理汇总了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)
开发者ID:omps,项目名称:beaker,代码行数:75,代码来源:tasks.py


注:本文中的bkr.server.model.RecipeTask.is_failed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。