def main(self): prioritized = self.get_priorities() self.db.rollback() # no-op, ends the transaction if (time.time() - self.calculation_timestamp > get_config('priorities.calculation_interval')): self.persist_priorities(prioritized) incomplete_builds = self.get_incomplete_builds_query().count() if incomplete_builds >= get_config('koji_config.max_builds'): self.log.debug("Not scheduling: {} incomplete builds" .format(incomplete_builds)) return koji_load = koji_util.get_koji_load(self.koji_sessions['primary']) if koji_load > get_config('koji_config.load_threshold'): self.log.debug("Not scheduling: {} koji load" .format(koji_load)) return for package_id, priority in prioritized: if priority < get_config('priorities.build_threshold'): self.log.debug("Not scheduling: no package above threshold") return package = self.db.query(Package).get(package_id) if package.collection.is_buildroot_broken(): self.log.debug("Skipping {}: {} buildroot broken" .format(package, package.collection)) continue newer_build = self.backend.get_newer_build_if_exists(package) if newer_build: self.log.debug("Skipping {} due to real build" .format(package)) continue # a package was chosen self.log.info('Scheduling build for {}, priority {}' .format(package.name, priority)) build = self.backend.submit_build(package) package.current_priority = None package.scheduler_skip_reason = None package.manual_priority = 0 if not build: self.log.debug("No SRPM found for {}".format(package.name)) package.scheduler_skip_reason = Package.SKIPPED_NO_SRPM self.db.commit() continue self.db.commit() break
def main(self): prioritized = self.get_priorities() self.db.rollback() # no-op, ends the transaction if (time.time() - self.calculation_timestamp > get_config('priorities.calculation_interval')): self.persist_priorities(prioritized) incomplete_builds = self.get_incomplete_builds_query().count() if incomplete_builds >= get_config('koji_config.max_builds'): self.log.debug("Not scheduling: {} incomplete builds".format( incomplete_builds)) return koji_load = koji_util.get_koji_load(self.koji_sessions['primary']) if koji_load > get_config('koji_config.load_threshold'): self.log.debug("Not scheduling: {} koji load".format(koji_load)) return for package_id, priority in prioritized: if priority < get_config('priorities.build_threshold'): self.log.debug("Not scheduling: no package above threshold") return package = self.db.query(Package).get(package_id) if package.collection.is_buildroot_broken(): self.log.debug("Skipping {}: {} buildroot broken".format( package, package.collection)) continue newer_build = self.backend.get_newer_build_if_exists(package) if newer_build: self.log.debug("Skipping {} due to real build".format(package)) continue # a package was chosen self.log.info('Scheduling build for {}, priority {}'.format( package.name, priority)) build = self.backend.submit_build(package) package.current_priority = None package.scheduler_skip_reason = None package.manual_priority = 0 if not build: self.log.debug("No SRPM found for {}".format(package.name)) package.scheduler_skip_reason = Package.SKIPPED_NO_SRPM self.db.commit() continue self.db.commit() break
def main(self): incomplete_builds_count = self.db.query(Build)\ .filter(Build.state == Build.RUNNING)\ .count() if incomplete_builds_count >= get_config('koji_config.max_builds'): self.log.debug("Not scheduling: {} incomplete builds" .format(incomplete_builds_count)) return for package_id, priority in self.get_priorities(): if priority < get_config('priorities.build_threshold'): self.log.info("Not scheduling: no package above threshold") return package = self.db.query(Package).get(package_id) koji_session = self.session.koji('primary') all_arches = koji_util.get_koji_arches_cached( self.session, koji_session, package.collection.build_tag, ) arches = koji_util.get_srpm_arches( koji_session=self.session.secondary_koji_for(package.collection), all_arches=all_arches, nvra=package.srpm_nvra, arch_override=package.arch_override, ) if arches is None: self.skip_no_srpm(package) continue if not arches: self.log.info("Skipping {}: no allowed arch".format(package.name)) package.scheduler_skip_reason = Package.SKIPPED_NO_ARCH # FIXME we don't have a better way how to get package out of # scheduler's way package.manual_priority -= 1000 continue koji_load_threshold = get_config('koji_config.load_threshold') if koji_load_threshold < 1: koji_load = koji_util.get_koji_load( koji_session=koji_session, all_arches=all_arches, arches=arches, ) if koji_load > koji_load_threshold: self.log.debug("Not scheduling {}: {} koji load" .format(package, koji_load)) return self.log.info('Scheduling build for {} in {}, priority {}' .format(package.name, package.collection.name, priority)) build = backend.submit_build( self.session, package, arch_override=None if 'noarch' in arches else arches, ) package.current_priority = None package.scheduler_skip_reason = None package.manual_priority = 0 if not build: self.skip_no_srpm(package) continue self.db.commit() break
def test_koji_load_arm(self): load = koji_util.get_koji_load(self.session, self.all_arches, ['armv7hl']) self.assertAlmostEqual(0.8958, load, 4)
def test_koji_load_intel(self): load = koji_util.get_koji_load(self.session, self.all_arches, ['i686', 'x86_64']) self.assertAlmostEqual(0.5119, load, 4)
def test_koji_load_noarch(self): load = koji_util.get_koji_load(self.session, self.all_arches, ['noarch']) self.assertAlmostEqual(0.4305, load, 4)