use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupPairSubmissionInDatabase.
/**
* Sets up an {@link AnalysisSubmission} with a set of
* {@link SequenceFilePair}s that have already been setup with samples.
*
* @param sequenceFilePairs
* The set of {@link SequenceFilePair}s to submit.
* @param referenceFilePath
* The path to an input reference file for this test.
* @param iridaWorkflowId
* The id of an irida workflow.
* @param parameters
* The parameters to use.
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupPairSubmissionInDatabase(Set<SequencingObject> sequenceFilePairs, Path referenceFilePath, Map<String, String> parameters, UUID iridaWorkflowId) {
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(sequenceFilePairs).referenceFile(referenceFile).inputParameters(parameters).build();
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission 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.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImpl method postProcessResults.
/**
* {@inheritDoc}
*/
@Override
public Set<Future<AnalysisSubmission>> postProcessResults() {
synchronized (postProcessingLock) {
logger.trace("Running postProcessResults");
List<AnalysisSubmission> analysisSubmissions = analysisSubmissionRepository.findByAnalysisState(AnalysisState.TRANSFERRED);
Set<Future<AnalysisSubmission>> submissions = Sets.newHashSet();
for (AnalysisSubmission analysisSubmission : analysisSubmissions) {
logger.debug("Post processing results for " + analysisSubmission);
submissions.add(analysisExecutionService.postProcessResults(analysisSubmission));
}
return submissions;
}
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImpl method transferAnalysesResults.
/**
* {@inheritDoc}
*/
@Override
public Set<Future<AnalysisSubmission>> transferAnalysesResults() {
synchronized (transferAnalysesResultsLock) {
logger.trace("Running transferAnalysesResults");
List<AnalysisSubmission> analysisSubmissions = analysisSubmissionRepository.findByAnalysisState(AnalysisState.FINISHED_RUNNING);
Set<Future<AnalysisSubmission>> submissions = Sets.newHashSet();
for (AnalysisSubmission analysisSubmission : analysisSubmissions) {
logger.debug("Transferring results for " + analysisSubmission);
try {
submissions.add(analysisExecutionService.transferAnalysisResults(analysisSubmission));
} catch (ExecutionManagerException | IOException | IridaWorkflowException e) {
logger.error("Error transferring submission " + analysisSubmission, e);
}
}
return submissions;
}
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisSubmissionCleanupServiceImpl method switchInconsistentSubmissionsToError.
/**
* {@inheritDoc}
*/
@Override
@PreAuthorize("hasRole('ROLE_ADMIN')")
public int switchInconsistentSubmissionsToError() {
if (ranSwitchInconsistentSubmissionsToError) {
throw new RuntimeException("already ran this method once");
} else {
int numberSubmissionsSwitched = 0;
ranSwitchInconsistentSubmissionsToError = true;
for (AnalysisState state : inconsistentStates) {
List<AnalysisSubmission> submissions = analysisSubmissionRepository.findByAnalysisState(state);
for (AnalysisSubmission submission : submissions) {
logger.error("AnalysisSubmission [id=" + submission.getId() + ", name=" + submission.getName() + ", state=" + submission.getAnalysisState() + "] left in inconsistent state. Switching to " + AnalysisState.ERROR + ".");
submission.setAnalysisState(AnalysisState.ERROR);
analysisSubmissionRepository.save(submission);
numberSubmissionsSwitched++;
}
}
return numberSubmissionsSwitched;
}
}
Aggregations