Search in sources :

Example 61 with AnalysisSubmission

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());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Future(java.util.concurrent.Future) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 62 with AnalysisSubmission

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);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Future(java.util.concurrent.Future) JobError(ca.corefacility.bioinformatics.irida.model.workflow.analysis.JobError) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 63 with AnalysisSubmission

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);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 64 with AnalysisSubmission

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);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 65 with AnalysisSubmission

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);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)183 Test (org.junit.Test)121 WithMockUser (org.springframework.security.test.context.support.WithMockUser)95 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)30 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)30 Path (java.nio.file.Path)25 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)23 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)20 Project (ca.corefacility.bioinformatics.irida.model.project.Project)19 History (com.github.jmchilton.blend4j.galaxy.beans.History)19 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)18 AnalysisOutputFile (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisOutputFile)18 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)18 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)18 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)15 User (ca.corefacility.bioinformatics.irida.model.user.User)15 EntityNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException)12 ExecutionManagerException (ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException)12 ProjectAnalysisSubmissionJoin (ca.corefacility.bioinformatics.irida.model.workflow.submission.ProjectAnalysisSubmissionJoin)12 ToolExecution (ca.corefacility.bioinformatics.irida.model.workflow.analysis.ToolExecution)11