def run(self): buildThreadFailed = False ThreadPool.ThreadPool.makeWorkerThreadActive(self.name) self.logger.info("Thread " + self.name + " is starting now") while True: outputMap = {} pkg = Scheduler.Scheduler.getNextPackageToBuild() if pkg is None: break self.logger.info("Thread " + self.name + " is building package:" + pkg) if self.pkgBuildType == "chroot": pkgBuilder = PackageBuilderChroot( self.mapPackageToCycle, self.listAvailableCyclicPackages, self.pkgBuildType) elif self.pkgBuildType == "container": pkgBuilder = PackageBuilderContainer( self.mapPackageToCycle, self.listAvailableCyclicPackages, self.pkgBuildType) pkgBuilder.buildPackageFunction(pkg, outputMap, pkg) if pkg not in outputMap or outputMap[pkg] == False: buildThreadFailed = True Scheduler.Scheduler.notifyPackageBuildFailed(pkg) self.logger.info("Thread " + self.name + " stopped building package:" + pkg) break self.logger.info("Thread " + self.name + " finished building package:" + pkg) Scheduler.Scheduler.notifyPackageBuildCompleted(pkg) if buildThreadFailed: self.statusEvent.set() ThreadPool.ThreadPool.makeWorkerThreadInActive(self.name) self.logger.info("Thread " + self.name + " is going to rest")
def run(self): buildThreadFailed = False ThreadPool.ThreadPool.makeWorkerThreadActive(self.name) self.logger.info("Thread " + self.name + " is starting now") while True: pkg = Scheduler.Scheduler.getNextPackageToBuild() if pkg is None: break if self.pkgBuildType == "chroot": pkgBuilder = PackageBuilderChroot(self.mapPackageToCycle, self.pkgBuildType) elif self.pkgBuildType == "container": pkgBuilder = PackageBuilderContainer(self.mapPackageToCycle, self.pkgBuildType) try: pkgBuilder.buildPackageFunction(pkg) except Exception as e: self.logger.exception(e) buildThreadFailed = True Scheduler.Scheduler.notifyPackageBuildFailed(pkg) self.logger.info("Thread " + self.name + " stopped building package:" + pkg) self.statusEvent.set() break Scheduler.Scheduler.notifyPackageBuildCompleted(pkg) ThreadPool.ThreadPool.makeWorkerThreadInActive(self.name) self.logger.info("Thread " + self.name + " is going to rest")
def run(self): buildThreadFailed = False ThreadPool.ThreadPool.makeWorkerThreadActive(self.name) self.logger.info("Thread " + self.name + " is starting now") while True: pkg = Scheduler.Scheduler.getNextPackageToBuild() if pkg is None: break self.logger.info("Thread " + self.name + " is building package:" + pkg) if self.pkgBuildType == "chroot": pkgBuilder = PackageBuilderChroot(self.mapPackageToCycle, self.pkgBuildType) elif self.pkgBuildType == "container": pkgBuilder = PackageBuilderContainer(self.mapPackageToCycle, self.pkgBuildType) try: pkgBuilder.buildPackageFunction(pkg) except Exception as e: self.logger.exception(e) buildThreadFailed = True Scheduler.Scheduler.notifyPackageBuildFailed(pkg) self.logger.info("Thread " + self.name + " stopped building package:" + pkg) self.statusEvent.set() break self.logger.info("Thread " + self.name + " finished building package:" + pkg) Scheduler.Scheduler.notifyPackageBuildCompleted(pkg) ThreadPool.ThreadPool.makeWorkerThreadInActive(self.name) self.logger.info("Thread " + self.name + " is going to rest")