@Override public void run() { Instant endOfProcessDate = new Date().toInstant().plus(duration); LOGGER.info("The process will finish at: " + endOfProcessDate); while (!new Date().toInstant().isAfter(endOfProcessDate)) { try { Thread.sleep(SLEEP_TIME * 1000); } catch (InterruptedException e) { LOGGER.warn("Sleep interrupted: premature stop will occured."); } } LOGGER.info("The process will now stop."); this.inspectBuilds.switchOff(); this.inspectJobs.switchOff(); this.buildRunner.switchOff(); if (this.endProcessNotifier != null) { this.endProcessNotifier.notifyEnd(); } } }
private void runPool() throws IOException { String runId = this.config.getRunId(); List<String> branchNames = this.readListOfBranches(); LOGGER.info("Find "+branchNames.size()+" branches to run."); this.docker = DockerHelper.initDockerClient(); String imageId = DockerHelper.findDockerImage(this.config.getDockerImageName(), this.docker); LOGGER.info("Found the following docker image id: "+imageId); ExecutorService executorService = Executors.newFixedThreadPool(this.config.getNbThreads()); for (String branchName : branchNames) { RunnablePipelineContainer runnablePipelineContainer = new RunnablePipelineContainer(imageId, branchName); submittedRunnablePipelineContainers.add(runnablePipelineContainer); executorService.submit(runnablePipelineContainer); } executorService.shutdown(); try { if (executorService.awaitTermination(this.config.getGlobalTimeout(), TimeUnit.DAYS)) { LOGGER.info("Job finished within time."); } else { LOGGER.warn("Timeout launched: the job is running for one day. Force stopped "+ submittedRunnablePipelineContainers.size()+" docker container(s)."); executorService.shutdownNow(); } } catch (InterruptedException e) { LOGGER.error("Error while await termination. Force stopped "+ submittedRunnablePipelineContainers.size()+" docker container(s).", e); executorService.shutdownNow(); } this.docker.close(); if (this.endProcessNotifier != null) { this.endProcessNotifier.notifyEnd(); } }
endProcessSerializer.serialize(); if (this.endProcessNotifier != null) { this.endProcessNotifier.notifyEnd();
private void mainProcess() throws IOException { LOGGER.info("Configuration: " + this.config.toString()); Map<ScannedBuildStatus, List<BuildToBeInspected>> buildsToBeInspected = this.runScanner(); if (buildsToBeInspected != null) { /*for (BuildToBeInspected buildToBeInspected : buildsToBeInspected) { if (this.config.getLauncherMode() == LauncherMode.REPAIR) { Launcher.LOGGER.info("Incriminated project and build: " + buildToBeInspected.getBuggyBuild().getRepository().getSlug() + ":" + buildToBeInspected.getBuggyBuild().getId()); } else { Launcher.LOGGER.info("Incriminated project and pair of builds: " + buildToBeInspected.getBuggyBuild().getRepository().getSlug() + ":" + buildToBeInspected.getBuggyBuild().getId() + "" + Utils.COMMA + "" + buildToBeInspected.getPatchedBuild().getId()); } }*/ this.processOutput(buildsToBeInspected); } else { Launcher.LOGGER.warn("The variable 'builds to be inspected' has null value."); } if (this.endProcessNotifier != null) { this.endProcessNotifier.notifyEnd(); } }