use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImplIT method testFullAnalysisRunFailInvalidWorkflowStatus.
/**
* Tests out failing to complete execution of a workflow due to an error
* with the status.
*
* @throws Throwable
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testFullAnalysisRunFailInvalidWorkflowStatus() throws Throwable {
analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, validIridaWorkflowId, false);
// PREPARE SUBMISSION
Set<Future<AnalysisSubmission>> submissionsFutureSet = analysisExecutionScheduledTask.prepareAnalyses();
assertEquals(1, submissionsFutureSet.size());
// wait until finished
for (Future<AnalysisSubmission> submissionFuture : submissionsFutureSet) {
AnalysisSubmission returnedSubmission = submissionFuture.get();
assertEquals(AnalysisState.PREPARED, returnedSubmission.getAnalysisState());
}
// EXECUTE SUBMISSION
submissionsFutureSet = analysisExecutionScheduledTask.executeAnalyses();
assertEquals(1, submissionsFutureSet.size());
// wait until finished
AnalysisSubmission returnedSubmission = submissionsFutureSet.iterator().next().get();
assertEquals(AnalysisState.RUNNING, returnedSubmission.getAnalysisState());
// Modify remoteAnalysisId so getting the status fails
returnedSubmission.setRemoteAnalysisId("invalid");
analysisSubmissionRepository.save(returnedSubmission);
// CHECK GALAXY STATUS
submissionsFutureSet = analysisExecutionScheduledTask.monitorRunningAnalyses();
// Should be in error state
assertEquals(1, submissionsFutureSet.size());
returnedSubmission = submissionsFutureSet.iterator().next().get();
assertEquals(AnalysisState.ERROR, returnedSubmission.getAnalysisState());
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImplIT method testFullAnalysisRunFailErrorWithJob.
/**
* Tests out failing to complete execution of a workflow due to an error
* with the workflow causing a job to fail.
*
* @throws Throwable
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testFullAnalysisRunFailErrorWithJob() throws Throwable {
analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, iridaWorkflowIdWithError, false);
// PREPARE SUBMISSION
Set<Future<AnalysisSubmission>> submissionsFutureSet = analysisExecutionScheduledTask.prepareAnalyses();
assertEquals(1, submissionsFutureSet.size());
// wait until finished
for (Future<AnalysisSubmission> submissionFuture : submissionsFutureSet) {
AnalysisSubmission returnedSubmission = submissionFuture.get();
assertEquals(AnalysisState.PREPARED, returnedSubmission.getAnalysisState());
}
// EXECUTE SUBMISSION
submissionsFutureSet = analysisExecutionScheduledTask.executeAnalyses();
assertEquals(1, submissionsFutureSet.size());
AnalysisSubmission executedSubmission = submissionsFutureSet.iterator().next().get();
assertEquals(AnalysisState.RUNNING, executedSubmission.getAnalysisState());
// wait until Galaxy finished
analysisExecutionGalaxyITService.waitUntilSubmissionComplete(executedSubmission);
// CHECK STATUS, should be in ERROR state.
submissionsFutureSet = analysisExecutionScheduledTask.monitorRunningAnalyses();
assertEquals(1, submissionsFutureSet.size());
AnalysisSubmission returnedSubmission = submissionsFutureSet.iterator().next().get();
assertEquals(AnalysisState.ERROR, returnedSubmission.getAnalysisState());
List<JobError> jobErrors = jobErrorRepository.findAllByAnalysisSubmission(returnedSubmission);
assertTrue("There should only be one JobError", jobErrors.size() == 1);
JobError jobError = jobErrors.get(0);
assertTrue("JobError should have some stderr message", jobError.getStandardError() != null && !jobError.getStandardError().equals(""));
assertTrue("JobError should be triggered by 'IndexError: list index out of range'", jobError.getStandardError().contains("IndexError: list index out of range"));
assertTrue("JobError tool ID should be 'Filter1'", jobError.getToolId().equals("Filter1"));
assertTrue("JobError exit code should be '1'", jobError.getExitCode() == 1);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImplIT method testFullAnalysisRunSuccessWithSampleUpdates.
/**
* Tests out successfully executing an analysis submission, from newly
* created to downloading results. Adds a analysissampleupdater step
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testFullAnalysisRunSuccessWithSampleUpdates() throws Exception {
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, validIridaWorkflowId, true);
validateFullAnalysisWithCleanup(Sets.newHashSet(analysisSubmission), 1);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImplIT method testFullAnalysisRunSuccess.
/**
* Tests out successfully executing an analysis submission, from newly
* created to downloading results.
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testFullAnalysisRunSuccess() throws Exception {
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, validIridaWorkflowId, false);
validateFullAnalysisWithCleanup(Sets.newHashSet(analysisSubmission), 1);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImplIT method testFullAnalysisRunFailAuthentication.
/**
* Tests out failure to run analysis due to authentication error.
*
* @throws Exception
*/
@Test(expected = AuthenticationCredentialsNotFoundException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testFullAnalysisRunFailAuthentication() throws Exception {
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, validIridaWorkflowId, false);
SecurityContextHolder.clearContext();
validateFullAnalysis(Sets.newHashSet(analysisSubmission), 1);
}
Aggregations