use of fr.inria.spirals.repairnator.dockerpool.serializer.EndProcessSerializer in project repairnator by Spirals-Team.
the class Launcher method runPool.
private void runPool() throws IOException {
String runId = this.config.getRunId();
HardwareInfoSerializer hardwareInfoSerializer = new HardwareInfoSerializer(this.engines, runId, "dockerPool");
hardwareInfoSerializer.serialize();
EndProcessSerializer endProcessSerializer = new EndProcessSerializer(this.engines, runId);
List<InputBuildId> buildIds = this.readListOfBuildIds();
LOGGER.info("Find " + buildIds.size() + " builds to run.");
endProcessSerializer.setNbBuilds(buildIds.size());
String imageId = this.findDockerImage(this.config.getDockerImageName());
LOGGER.info("Found the following docker image id: " + imageId);
this.setDockerOutputDir(this.config.getLogDirectory());
this.setRunId(runId);
this.setEngines(this.engines);
ExecutorService executorService = Executors.newFixedThreadPool(this.config.getNbThreads());
for (InputBuildId inputBuildId : buildIds) {
executorService.submit(this.submitBuild(imageId, inputBuildId));
}
executorService.shutdown();
try {
if (executorService.awaitTermination(this.config.getGlobalTimeout(), TimeUnit.DAYS)) {
LOGGER.info("Job finished within time.");
endProcessSerializer.setStatus("ok");
} else {
LOGGER.warn("Timeout launched: the job is running for one day. Force stopped " + submittedRunnablePipelineContainers.size() + " docker container(s).");
executorService.shutdownNow();
this.setStatusForUnexecutedJobs();
endProcessSerializer.setStatus("timeout");
}
} catch (InterruptedException e) {
LOGGER.error("Error while await termination. Force stopped " + submittedRunnablePipelineContainers.size() + " docker container(s).", e);
executorService.shutdownNow();
this.setStatusForUnexecutedJobs();
endProcessSerializer.setStatus("interrupted");
}
this.getDockerClient().close();
endProcessSerializer.serialize();
if (this.endProcessNotifier != null) {
this.endProcessNotifier.notifyEnd();
}
}
Aggregations