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


Python BuildsLogic.get_build_task_queue方法代码示例

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


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

示例1: test_build_queue_3

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_build_task_queue [as 别名]
 def test_build_queue_3(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
     for build_chroots in [self.b1_bc, self.b2_bc, self.b3_bc, self.b4_bc]:
         for build_chroot in build_chroots:
             build_chroot.status = 0
     self.db.session.commit()
     data = BuildsLogic.get_build_task_queue().all()
     assert len(data) == 0
开发者ID:0-T-0,项目名称:copr,代码行数:9,代码来源:test_builds_logic.py

示例2: waiting

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_build_task_queue [as 别名]
def waiting():
    """
    Return list of waiting actions and builds.
    """

    # models.Actions
    actions_list = [
        action.to_dict(options={
            "__columns_except__": ["result", "message", "ended_on"]
        })
        for action in actions_logic.ActionsLogic.get_waiting()
    ]

    # tasks represented by models.BuildChroot with some other stuff
    builds_list = []
    for task in BuildsLogic.get_build_task_queue().limit(200):
        try:
            copr = task.build.copr

            # we are using fake username's here
            if copr.is_a_group_project:
                user_name = u"@{}".format(copr.group.name)
            else:
                user_name = copr.user.name

            record = {
                "task_id": task.task_id,
                "build_id": task.build.id,
                "project_owner": user_name,
                "project_name": task.build.copr.name,
                "submitter": task.build.user.name if task.build.user else None, # there is no user for webhook builds
                "pkgs": task.build.pkgs,  # TODO to be removed
                "chroot": task.mock_chroot.name,

                "repos": task.build.repos,
                "memory_reqs": task.build.memory_reqs,
                "timeout": task.build.timeout,
                "enable_net": task.build.enable_net,
                "git_repo": task.build.package.dist_git_repo,
                "git_hash": task.git_hash,
                "git_branch": helpers.chroot_to_branch(task.mock_chroot.name),
                "package_name": task.build.package.name,
                "package_version": task.build.pkg_version
            }
            copr_chroot = CoprChrootsLogic.get_by_name_safe(task.build.copr, task.mock_chroot.name)
            if copr_chroot:
                record["buildroot_pkgs"] = copr_chroot.buildroot_pkgs
            else:
                record["buildroot_pkgs"] = ""

            builds_list.append(record)

        except Exception as err:
            app.logger.exception(err)

    response_dict = {"actions": actions_list, "builds": builds_list}
    return flask.jsonify(response_dict)
开发者ID:ignatenkobrain,项目名称:copr,代码行数:59,代码来源:backend_general.py

示例3: test_build_queue_4

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_build_task_queue [as 别名]
    def test_build_queue_4(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
        for build_chroots in [self.b1_bc, self.b2_bc]:
            for build_chroot in build_chroots:
                build_chroot.status = 3  # running
        for build_chroots in [self.b3_bc, self.b4_bc]:
            for build_chroot in build_chroots:
                build_chroot.status = 0

        time_now = int(time.time())

        self.b1.started_on = time_now - 100000

        self.db.session.commit()
        data = BuildsLogic.get_build_task_queue().all()

        assert len(data) == 1
        assert data[0] == self.b1_bc[0]
开发者ID:1dot75cm,项目名称:Copr,代码行数:19,代码来源:test_builds_logic.py

示例4: test_build_queue_4

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_build_task_queue [as 别名]
    def test_build_queue_4(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
        time_now = int(time.time())
        for build_chroots in [self.b1_bc, self.b2_bc]:
            for build_chroot in build_chroots:
                build_chroot.status = StatusEnum("running")
                build_chroot.started_on = time_now - 2 * MAX_BUILD_TIMEOUT
                build_chroot.ended_on = None
        for build_chroots in [self.b3_bc, self.b4_bc]:
            for build_chroot in build_chroots:
                build_chroot.status = StatusEnum("failed")
                build_chroot.started_on = time_now - 2 * MAX_BUILD_TIMEOUT
                build_chroot.ended_on = None

        self.db.session.commit()
        data = BuildsLogic.get_build_task_queue().all()

        assert len(data) == 2
        assert set([data[0], data[1]]) == set([self.b1_bc[0], self.b2_bc[0]])
开发者ID:0-T-0,项目名称:copr,代码行数:20,代码来源:test_builds_logic.py

示例5: test_build_queue_6

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_build_task_queue [as 别名]
 def test_build_queue_6(self, f_users, f_coprs, f_mock_chroots, f_db):
     self.db.session.commit()
     data = BuildsLogic.get_build_task_queue().all()
     assert len(data) == 0
开发者ID:0-T-0,项目名称:copr,代码行数:6,代码来源:test_builds_logic.py


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