return res.avg
- def create_test_jobs(self):
- max_queue_length = self.backend.settings.get_int("test_queue_limit", 25)
-
- threshold_days = self.backend.settings.get_int("test_threshold_days", 14)
- threshold = datetime.datetime.utcnow() - datetime.timedelta(days=threshold_days)
-
- for arch in self.backend.arches:
- # Skip adding new jobs if there are more too many jobs in the queue.
- limit = max_queue_length - self.backend.jobqueue.get_length_for_arch(arch)
- if limit <= 0:
- log.debug("Already too many jobs in queue of %s to create tests." % arch)
- continue
-
- # Get a list of builds, with potentially need a test build.
- # Randomize the output and do not return more jobs than we are
- # allowed to put into the build queue.
- builds = self.backend.builds._get_builds("SELECT builds.* FROM builds \
- LEFT JOIN jobs ON builds.id = jobs.build_id \
- WHERE builds.type = %s AND builds.state = ANY(%s) AND jobs.state = %s \
- AND NOT EXISTS (SELECT 1 FROM jobs test_jobs \
- WHERE test_jobs.build_id = builds.id AND jobs.test IS %s \
- AND (test_jobs.state <> %s OR test_jobs.state = %s AND test_jobs.time_finished >= %s)) LIMIT %s",
- "release", ["stable", "testing"], "finished", True, "finished", "finished", threshold, limit)
-
- # Search for the job with the right architecture in each
- # build and schedule a test job.
- for build in builds:
- for job in build:
- if job.arch == arch:
- job.restart()
- break
-
def check_build_dependencies(self):
# Check all jobs that have never being checked before
self._check_build_dependencies("SELECT * FROM jobs \