use of ca.corefacility.bioinformatics.irida.processing.FileProcessor in project irida by phac-nml.
the class DefaultFileProcessingChain method launchChain.
/**
* {@inheritDoc}
*/
@Override
public List<Exception> launchChain(Long sequencingObjectId) throws FileProcessorTimeoutException {
List<Exception> ignoredExceptions = new ArrayList<>();
Integer waiting = 0;
// file has been persisted in the database.
while (!sequencingObjectRepository.exists(sequencingObjectId)) {
if (waiting > timeout) {
throw new FileProcessorTimeoutException("Waiting for longer than " + sleepDuration * timeout + "ms, bailing out.");
}
waiting++;
try {
Thread.sleep(sleepDuration);
} catch (InterruptedException e) {
}
}
for (FileProcessor fileProcessor : fileProcessors) {
try {
if (fileProcessor.shouldProcessFile(sequencingObjectId)) {
SequencingObject settledSequencingObject = getSettledSequencingObject(sequencingObjectId);
fileProcessor.process(settledSequencingObject);
}
} catch (FileProcessorException e) {
SequencingObject sequencingObject = sequencingObjectRepository.findOne(sequencingObjectId);
qcRepository.save(new FileProcessorErrorQCEntry(sequencingObject));
// execution (show the error, but proceed).
if (fileProcessor.modifiesFile() || fastFail) {
throw e;
} else {
ignoredExceptions.add(e);
logger.error("File processor [" + fileProcessor.getClass() + "] failed to process [" + sequencingObjectId + "], but proceeding with the remaining processors because the " + "file would not be modified by the processor. Stack trace follows.", e);
}
}
}
return ignoredExceptions;
}
Aggregations