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


Python RecipeTask.by_id方法代码示例

本文整理汇总了Python中bkr.server.model.RecipeTask.by_id方法的典型用法代码示例。如果您正苦于以下问题:Python RecipeTask.by_id方法的具体用法?Python RecipeTask.by_id怎么用?Python RecipeTask.by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bkr.server.model.RecipeTask的用法示例。


在下文中一共展示了RecipeTask.by_id方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_recipe_task_by_id

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
def _get_recipe_task_by_id(recipeid, taskid):
    try:
        task = RecipeTask.by_id(taskid)
    except NoResultFound:
        raise NotFound404('Recipe task not found')
    if recipeid != '_' and str(task.recipe.id) != recipeid:
        raise NotFound404('Recipe task not found')
    return task
开发者ID:beaker-project,项目名称:beaker,代码行数:10,代码来源:recipetasks.py

示例2: watchdog

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def watchdog(self, task_id):
     """
     Returns number of seconds left on task_id watchdog, or False if it doesn't exist.
     """
     try:
         task = RecipeTask.by_id(task_id)
     except InvalidRequestError:
         raise BX(_('Invalid task ID: %s' % task_id))
     return task.status_watchdog()
开发者ID:ShaolongHu,项目名称:beaker,代码行数:11,代码来源:recipetasks.py

示例3: extend

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def extend(self, task_id, kill_time):
     """
     Extend tasks watchdog by kill_time seconds
     """
     try:
         task = RecipeTask.by_id(task_id)
     except InvalidRequestError:
         raise BX(_('Invalid task ID: %s' % task_id))
     return task.extend(kill_time)
开发者ID:ShaolongHu,项目名称:beaker,代码行数:11,代码来源:recipetasks.py

示例4: start

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def start(self, task_id, watchdog_override=None):
     """
     Set task status to Running
     """
     try:
         task = RecipeTask.by_id(task_id)
     except InvalidRequestError:
         raise BX(_('Invalid task ID: %s' % task_id))
     return task.start(watchdog_override)
开发者ID:ShaolongHu,项目名称:beaker,代码行数:11,代码来源:recipetasks.py

示例5: result

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def result(self, task_id, result_type, path=None, score=None, summary=None):
     """
     Record a Result
     """
     try:
         task = RecipeTask.by_id(task_id)
     except InvalidRequestError:
         raise BX(_('Invalid task ID: %s' % task_id))
     if result_type not in task.result_types:
         raise BX(_('Invalid result_type: %s, must be one of %s' %
                          (result_type, task.result_types)))
     kwargs = dict(path=path, score=score, summary=summary)
     return getattr(task,result_type)(**kwargs)
开发者ID:ShaolongHu,项目名称:beaker,代码行数:15,代码来源:recipetasks.py

示例6: stop

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def stop(self, task_id, stop_type, msg=None):
     """
     Set task status to Completed
     """
     try:
         task = RecipeTask.by_id(task_id)
     except InvalidRequestError:
         raise BX(_('Invalid task ID: %s' % task_id))
     if stop_type not in task.stop_types:
         raise BX(_('Invalid stop_type: %s, must be one of %s' %
                          (stop_type, task.stop_types)))
     kwargs = dict(msg = msg)
     return getattr(task,stop_type)(**kwargs)
开发者ID:ShaolongHu,项目名称:beaker,代码行数:15,代码来源:recipetasks.py

示例7: update

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def update(self, task_id, data):
     """
     XML-RPC method used by the lab controller harness API to update 
     a recipe-task's attributes.
     """
     try:
         task = RecipeTask.by_id(task_id)
     except InvalidRequestError:
         raise BX(_('Invalid task ID: %s' % task_id))
     if 'name' in data:
         task.name = data['name']
     if 'version' in data:
         task.version = data['version']
     return task.__json__()
开发者ID:sujithshankar,项目名称:beaker,代码行数:16,代码来源:recipetasks.py

示例8: register_result_file

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
    def register_result_file(self, server, result_id, path, filename, basepath):
        """
        register file and return path to store
        """
        try:
            result = RecipeTaskResult.by_id(result_id, lockmode='update')
        except NoResultFound:
            raise BX(_('Invalid result ID: %s' % result_id))
        RecipeTask.by_id(result.recipe_task_id, lockmode='update')
        Recipe.by_id(result.recipetask.recipe_id, lockmode='update')
        if result.recipetask.is_finished():
            raise BX('Cannot register file for finished task %s'
                    % result.recipetask.t_id)
        self._check_log_limit(result.recipetask)

        log_recipe = LogRecipeTaskResult.lazy_create(recipe_task_result_id=result.id,
                                                     path=path, 
                                                     filename=filename,
                                                    )
        log_recipe.server = server
        log_recipe.basepath = basepath
        result.recipetask.recipe.log_server = urlparse.urlparse(server)[1]
        return '%s' % result.filepath
开发者ID:beaker-project,项目名称:beaker,代码行数:25,代码来源:recipetasks.py

示例9: register_file

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
    def register_file(self, server, task_id, path, filename, basepath):
        """
        register file and return path to store
        """
        try:
            recipetask = RecipeTask.by_id(task_id)
        except InvalidRequestError:
            raise BX(_('Invalid task ID: %s' % task_id))
        if recipetask.is_finished():
            raise BX('Cannot register file for finished task %s'
                    % recipetask.t_id)

        # Add the log to the DB if it hasn't been recorded yet.
        log_recipe = LogRecipeTask.lazy_create(recipe_task_id=recipetask.id,
                                               path=path, 
                                               filename=filename,
                                              )
        log_recipe.server = server
        log_recipe.basepath = basepath
        recipetask.recipe.log_server = urlparse.urlparse(server)[1]
        return '%s' % recipetask.filepath
开发者ID:ShaolongHu,项目名称:beaker,代码行数:23,代码来源:recipetasks.py

示例10: peer_roles

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def peer_roles(self, task_id):
     try:
         task = RecipeTask.by_id(task_id)
     except NoResultFound:
         raise BX(_('Invalid task ID: %s') % task_id)
     # don't use set, we want to preserve ordering
     roles = {}
     for role, recipes in task.recipe.peer_roles().iteritems():
         fqdns = roles.setdefault(unicode(role), [])
         for recipe in recipes:
             if not recipe.resource or not recipe.resource.fqdn:
                 continue
             fqdn = unicode(recipe.resource.fqdn)
             if fqdn not in fqdns:
                 fqdns.append(fqdn)
     for role, tasks in task.peer_roles().iteritems():
         fqdns = roles.setdefault(unicode(role), [])
         for task in tasks:
             if not task.recipe.resource or not task.recipe.resource.fqdn:
                 continue
             fqdn = unicode(task.recipe.resource.fqdn)
             if fqdn not in fqdns:
                 fqdns.append(fqdn)
     return roles
开发者ID:ShaolongHu,项目名称:beaker,代码行数:26,代码来源:recipetasks.py

示例11: to_xml

# 需要导入模块: from bkr.server.model import RecipeTask [as 别名]
# 或者: from bkr.server.model.RecipeTask import by_id [as 别名]
 def to_xml(self, id):
     taskxml = RecipeTask.by_id(id).to_xml().toprettyxml()
     return dict(xml=taskxml)
开发者ID:ShaolongHu,项目名称:beaker,代码行数:5,代码来源:recipetasks.py


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