def __setattr__(self, name, value): """Override setattr to log build status changes""" if name == "status": RebuilddLog.info("Job %s for %s_%s on %s/%s changed status from %s to %s"\ % (self.id, self.package.name, self.package.version, self.dist, self.arch, JobStatus.whatis(self.status), JobStatus.whatis(value))) self.status_changed = sqlobject.DateTimeCol.now() sqlobject.SQLObject.__setattr__(self, name, value)
def fix_jobs(self, print_result=True): """If rebuildd crashed, reset jobs to a valid state""" jobs = [] jobs.extend(Job.selectBy(host=socket.gethostname(), status=JobStatus.WAIT_LOCKED)) jobs.extend(Job.selectBy(host=socket.gethostname(), status=JobStatus.BUILDING)) for job in jobs: if print_result: print "I: Fixing job %s (was %s)" % (job.id, JobStatus.whatis(job.status)) job.host = None job.status = JobStatus.WAIT job.build_start = None job.build_end = None return True
def fix_jobs(self, print_result=True): """If rebuildd crashed, reset jobs to a valid state""" jobs = [] jobs.extend( Job.selectBy(host=socket.gethostname(), status=JobStatus.WAIT_LOCKED)) jobs.extend( Job.selectBy(host=socket.gethostname(), status=JobStatus.BUILDING)) for job in jobs: if print_result: print "I: Fixing job %s (was %s)" % ( job.id, JobStatus.whatis(job.status)) job.host = None job.status = JobStatus.WAIT job.build_start = None job.build_end = None return True
def __str__(self): return "I: Job %s for %s_%s is status %s on %s for %s/%s" % \ (self.id, self.package.name, self.package.version, self.host, JobStatus.whatis(self.status), self.dist, self.arch)
self.host = None build_log.write("\nBuild job killed on request\n") build_log.close() return # build is finished with self.status_lock: if state == 0: self.status = JobStatus.BUILD_OK self.build_end = sqlobject.DateTimeCol.now() build_log.write("******************************************************************************\n") build_log.write("Finished with status %s at %s\n" % (JobStatus.whatis(self.status), self.build_end)) build_log.write("Build needed %s\n" % (self.build_end - self.build_start)) build_log.close() # Send event to Rebuildd to inform it that it can # run a brand new job! if self.notify: self.notify.set() self.send_build_log() def send_build_log(self): """When job is built, send logs by mail""" try: