return list(jobs)
- def pop(self, builder):
+ def get_jobs_for_builder(self, builder, limit=None):
"""
- Returns the next build job that matches the given architectures
+ Returns all jobs that the given builder can process.
"""
- return self.backend.jobs._get_job("""
+ return self.backend.jobs._get_jobs("""
%s
SELECT
job_queue
WHERE
job_queue.arch = ANY(%%s)
- LIMIT 1
""" % JOB_QUEUE_CTE, builder.supported_arches,
)
log.debug(" Processing builder %s" % builder)
with self.backend.db.transaction():
- # We are ready for a new job
- job = self.pop(builder)
+ try:
+ # We are ready for a new job
+ for job in self.get_jobs_for_builder(builder):
+ # Perform installcheck (just to be sure)
+ if not await job.installcheck():
+ log.debug("Job %s failed its installcheck" % job)
+ continue
- # If no job could be found for this builder, we simply continue
- if not job:
- log.debug(" No jobs processable for %s" % builder)
- continue
+ # If we have a job, we dispatch it to the builder
+ builder.dispatch_job(job)
- # If we have a job, we dispatch it to the builder
- try:
- builder.dispatch_job(job)
+ # Once we dispatched a job, we are done
+ break
# Ignore if the builder suddenly went away
except BuilderNotOnlineError:
"""
await self.build.build_repo.installcheck([self])
+ # Return whether the check succeeded or not
+ return self.installcheck_succeeded
+
async def _installcheck(self, p):
"""
Implementation that takes an active Pakfire instance and