def test_build_queue_5(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db): for build_chroots in [self.b2_bc, self.b3_bc, self.b4_bc]: for build_chroot in build_chroots: build_chroot.status = 4 # pending self.db.session.commit() data = BuildsLogic.get_pending_build_tasks().all() assert len(data) == 5
def pending_jobs(): """ Return the job queue. """ srpm_tasks = [build for build in BuildsLogic.get_pending_srpm_build_tasks() if not build.blocked] build_records = ( [get_srpm_build_record(task) for task in srpm_tasks] + [get_build_record(task, short=True) for task in BuildsLogic.get_pending_build_tasks()] ) log.info('Selected build records: {}'.format(build_records)) return flask.jsonify(build_records)
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_pending_build_tasks().all() assert len(data) == 2 assert set([data[0], data[1]]) == set([self.b1_bc[0], self.b2_bc[0]])
def test_build_queue_6(self, f_users, f_coprs, f_mock_chroots, f_db): self.db.session.commit() data = BuildsLogic.get_pending_build_tasks().all() assert len(data) == 0