use of ca.corefacility.bioinformatics.irida.exceptions.AnalysisAlreadySetException in project irida by phac-nml.
the class TestDataFactory method constructAnalysisSubmission.
public static AnalysisSubmission constructAnalysisSubmission() {
Set<SequencingObject> files = new HashSet<>();
files.add(constructSingleEndSequenceFile());
Long id = 5L;
final ReferenceFile rf = new ReferenceFile(files.iterator().next().getFiles().iterator().next().getFile());
rf.setId(id);
AnalysisSubmission analysisSubmission = AnalysisSubmission.builder(UUID.randomUUID()).name("submission-" + id).inputFiles(files).referenceFile(rf).build();
analysisSubmission.setId(id);
analysisSubmission.setAnalysisState(AnalysisState.COMPLETED);
try {
analysisSubmission.setAnalysis(constructAnalysis());
} catch (final AnalysisAlreadySetException e) {
// this should *never* happen, we just constructed
// AnalysisSubmission above.
fail();
}
return analysisSubmission;
}
use of ca.corefacility.bioinformatics.irida.exceptions.AnalysisAlreadySetException in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyAsync method transferAnalysisResults.
/**
* Downloads and saves the results of an {@link AnalysisSubmission} that was
* previously submitted from an execution manager.
*
* @param submittedAnalysis
* An {@link AnalysisSubmission} that was previously submitted.
* @return A {@link Future} with an {@link AnalysisSubmission} object
* containing information about the particular analysis.
* @throws ExecutionManagerException
* If there was an issue with the execution manager.
* @throws IridaWorkflowNotFoundException
* If the workflow for this submission could not be found in
* IRIDA.
* @throws IOException
* If there was an error loading the analysis results from an
* execution manager.
* @throws IridaWorkflowAnalysisTypeException
* If there was an issue building an {@link Analysis} object.
*/
@Transactional
public Future<AnalysisSubmission> transferAnalysisResults(AnalysisSubmission submittedAnalysis) throws ExecutionManagerException, IOException, IridaWorkflowNotFoundException, IridaWorkflowAnalysisTypeException {
checkNotNull(submittedAnalysis, "submittedAnalysis is null");
checkNotNull(submittedAnalysis.getRemoteAnalysisId(), "remoteAnalysisId is null");
if (!analysisSubmissionService.exists(submittedAnalysis.getId())) {
throw new EntityNotFoundException("Could not find analysis submission for " + submittedAnalysis);
}
logger.debug("Getting results for " + submittedAnalysis);
Analysis analysisResults = workspaceService.getAnalysisResults(submittedAnalysis);
logger.trace("Saving results for " + submittedAnalysis);
Analysis savedAnalysis = analysisService.create(analysisResults);
// if samples should be updated, set to TRANSFERRED. Otherwise just complete.
if (submittedAnalysis.getUpdateSamples()) {
submittedAnalysis.setAnalysisState(AnalysisState.TRANSFERRED);
} else {
submittedAnalysis.setAnalysisState(AnalysisState.COMPLETED);
}
try {
submittedAnalysis.setAnalysis(savedAnalysis);
} catch (AnalysisAlreadySetException e) {
throw new ExecutionManagerException("Analysis already set", e);
}
AnalysisSubmission completedSubmission = analysisSubmissionService.update(submittedAnalysis);
return new AsyncResult<>(completedSubmission);
}
Aggregations