use of ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException in project irida by phac-nml.
the class AnalysisSubmissionServiceImpl method delete.
/**
* {@inheritDoc}
*/
@Override
@PreAuthorize("hasRole('ROLE_ADMIN') or hasPermission(#id, 'canUpdateAnalysisSubmission')")
@Transactional
public void delete(Long id) throws EntityNotFoundException {
final AnalysisSubmission submission = read(id);
if (AnalysisCleanedState.NOT_CLEANED.equals(submission.getAnalysisCleanedState())) {
// We're "CLEANING" it right now!
submission.setAnalysisCleanedState(AnalysisCleanedState.CLEANING);
try {
analysisExecutionService.cleanupSubmission(submission).get();
} catch (final ExecutionManagerException e) {
logger.error("Failed to cleanup analysis submission before deletion," + " but proceeding with deletion anyway.", e);
} catch (final Throwable e) {
logger.error("An unexpected exception happened when cleaning the analysis submission," + " but proceeding with deletion anyway.", e);
}
} else {
logger.debug("Not cleaning submission [" + id + "] when deleting, it's already cleaned.");
}
super.delete(id);
}
use of ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException in project irida by phac-nml.
the class GalaxyHistoriesService method constructCollection.
/**
* Builds a new Dataset Collection given the description of this collection.
* @param collectionDescription A description of the collection to build.
* @param history The history to build the collection within.
* @return A CollectionResponse describing the constructed collection.
* @throws ExecutionManagerException If there was an issue constructing the collection.
*/
public CollectionResponse constructCollection(CollectionDescription collectionDescription, History history) throws ExecutionManagerException {
checkNotNull(collectionDescription, "collectionDescription is null");
checkNotNull(history, "history is null");
try {
return historiesClient.createDatasetCollection(history.getId(), collectionDescription);
} catch (RuntimeException e) {
throw new ExecutionManagerException("Could not construct dataset collection", e);
}
}
use of ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException in project irida by phac-nml.
the class GalaxyWorkflowsIT method constructPairedFileCollection.
/**
* Constructs a collection containing a list of files from the given datasets.
* @param inputDatasetsForward The forward datasets to construct a collection from.
* @param inputDatasetsReverse The reverse datasets to construct a collection from.
* @param history The history to construct the collection within.
* @return A CollectionResponse describing the dataset collection.
* @throws ExecutionManagerException If an exception occured constructing the collection.
*/
public CollectionResponse constructPairedFileCollection(List<Dataset> inputDatasetsForward, List<Dataset> inputDatasetsReverse, History history) throws ExecutionManagerException {
checkNotNull(inputDatasetsForward, "inputDatasetsForward is null");
checkNotNull(inputDatasetsReverse, "inputDatasetsReverse is null");
checkNotNull(history, "history is null");
checkNotNull(history.getId(), "history does not have an associated id");
checkArgument(inputDatasetsForward.size() == inputDatasetsReverse.size(), "inputDatasets do not have equal sizes");
CollectionDescription collectionDescription = new CollectionDescription();
collectionDescription.setCollectionType(DatasetCollectionType.LIST_PAIRED.toString());
collectionDescription.setName(COLLECTION_NAME);
for (int i = 0; i < inputDatasetsForward.size(); i++) {
Dataset datasetForward = inputDatasetsForward.get(i);
Dataset datasetReverse = inputDatasetsReverse.get(i);
HistoryDatasetElement elementForward = new HistoryDatasetElement();
elementForward.setId(datasetForward.getId());
elementForward.setName(FORWARD_PAIR_NAME);
HistoryDatasetElement elementReverse = new HistoryDatasetElement();
elementReverse.setId(datasetReverse.getId());
elementReverse.setName(REVERSE_PAIR_NAME);
// Create an object to link together the forward and reverse reads for file2
CollectionElement element = new CollectionElement();
element.setName(BASE_NAME + i);
element.setCollectionType(DatasetCollectionType.PAIRED.toString());
element.addCollectionElement(elementForward);
element.addCollectionElement(elementReverse);
collectionDescription.addDatasetElement(element);
}
try {
return historiesClient.createDatasetCollection(history.getId(), collectionDescription);
} catch (RuntimeException e) {
throw new ExecutionManagerException("Could not construct dataset collection", e);
}
}
use of ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException in project irida by phac-nml.
the class AnalysisProvenanceServiceGalaxyTest method testShowProvenanceFailureNoFiles.
@Test(expected = ExecutionManagerException.class)
public void testShowProvenanceFailureNoFiles() throws ExecutionManagerException {
when(galaxyHistoriesService.showHistoryContents(any(String.class))).thenReturn(Lists.newArrayList());
when(galaxyHistoriesService.showProvenance(any(String.class), any(String.class))).thenThrow(new ExecutionManagerException());
provenanceService.buildToolExecutionForOutputFile(analysisSubmission(), analysisOutputFile());
}
use of ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException in project irida by phac-nml.
the class AnalysisProvenanceServiceGalaxy method buildToolExecutionForOutputFile.
/**
* Build up a provenance report for a specific file that's attached to the
* outputs of an analysis submission.
*
* @param remoteAnalysisId
* the identifier of the submission history that the output file
* is attached to on the execution manager (i.e., Galaxy's
* history id).
* @param analysisOutputFilename
* the filename to build the report for. This should be the raw
* basename of the file (i.e., only the filename + extension
* part).
* @return the complete report for the file.
* @throws ExecutionManagerException
* if the history contents could not be shown for the specified
* file.
*/
public ToolExecution buildToolExecutionForOutputFile(final String remoteAnalysisId, final String analysisOutputFilename) throws ExecutionManagerException {
final List<HistoryContents> historyContents = galaxyHistoriesService.showHistoryContents(remoteAnalysisId);
// group the history contents by name. The names that we're interested
// in starting from should match the filename of the output file.
final Map<String, List<HistoryContents>> historyContentsByName = historyContents.stream().collect(Collectors.groupingBy(HistoryContents::getName));
final List<HistoryContents> currentContents = historyContentsByName.get(analysisOutputFilename);
if (currentContents == null || currentContents.isEmpty() || currentContents.size() > 1) {
throw new ExecutionManagerException("Could not load a unique history contents for the specified filename [" + analysisOutputFilename + "] in history with id [" + remoteAnalysisId + "]");
}
final HistoryContentsProvenance currentProvenance = galaxyHistoriesService.showProvenance(remoteAnalysisId, currentContents.get(0).getId());
try {
final Tool toolDetails = toolsClient.showTool(currentProvenance.getToolId());
return buildToolExecutionForHistoryStep(toolDetails, currentProvenance, remoteAnalysisId);
} catch (final RuntimeException e) {
throw new ExecutionManagerException("Failed to build tool execution provenance.", e);
}
}
Aggregations