Search in sources :

Example 31 with GalaxyWorkflowStatus

use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus in project irida by phac-nml.

the class AnalysisExecutionServiceGalaxyIT method testExecuteAnalysisSuccess.

/**
 * Tests out successfully submitting a workflow for execution.
 *
 * @throws InterruptedException
 * @throws NoSuchValueException
 * @throws ExecutionManagerException
 * @throws IOException
 * @throws ExecutionException
 * @throws IridaWorkflowException
 */
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testExecuteAnalysisSuccess() throws InterruptedException, NoSuchValueException, ExecutionManagerException, IOException, ExecutionException, IridaWorkflowException {
    AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, validIridaWorkflowId, false);
    Future<AnalysisSubmission> analysisSubmittedFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
    AnalysisSubmission analysisSubmitted = analysisSubmittedFuture.get();
    Future<AnalysisSubmission> analysisExecutedFuture = analysisExecutionService.executeAnalysis(analysisSubmitted);
    AnalysisSubmission analysisExecuted = analysisExecutedFuture.get();
    assertEquals(AnalysisState.RUNNING, analysisExecuted.getAnalysisState());
    assertNotNull("remoteAnalysisId is null", analysisExecuted.getRemoteAnalysisId());
    assertNotNull("remoteInputDataId is null", analysisExecuted.getRemoteInputDataId());
    GalaxyWorkflowStatus status = analysisExecutionService.getWorkflowStatus(analysisExecuted);
    analysisExecutionGalaxyITService.assertValidStatus(status);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 32 with GalaxyWorkflowStatus

use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus in project irida by phac-nml.

the class AnalysisExecutionServiceGalaxyTest method testGetWorkflowStatusSuccess.

/**
 * Tests out successfully getting the status of a workflow.
 *
 * @throws ExecutionManagerException
 */
@Test
public void testGetWorkflowStatusSuccess() throws ExecutionManagerException {
    GalaxyWorkflowStatus workflowStatus = new GalaxyWorkflowStatus(GalaxyWorkflowState.OK, Maps.newHashMap());
    analysisSubmission.setRemoteAnalysisId(ANALYSIS_ID);
    when(galaxyHistoriesService.getStatusForHistory(analysisSubmission.getRemoteAnalysisId())).thenReturn(workflowStatus);
    assertEquals(workflowStatus, workflowManagement.getWorkflowStatus(analysisSubmission));
}
Also used : GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) Test(org.junit.Test)

Example 33 with GalaxyWorkflowStatus

use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus in project irida by phac-nml.

the class AnalysisExecutionScheduledTaskImplTest method testMonitorRunningAnalysesSuccessErrorStillRunning.

/**
 * Tests successfully switching an analysis to {@link AnalysisState.ERROR}
 * if there was an Galaxy job with an error, but still running.
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowNotFoundException
 */
@Test
public void testMonitorRunningAnalysesSuccessErrorStillRunning() throws ExecutionManagerException, IridaWorkflowNotFoundException {
    analysisSubmission.setAnalysisState(AnalysisState.RUNNING);
    Map<GalaxyWorkflowState, Set<String>> stateIds = Util.buildStateIdsWithStateFilled(GalaxyWorkflowState.ERROR, Sets.newHashSet("1"));
    GalaxyWorkflowStatus galaxyWorkflowStatus = new GalaxyWorkflowStatus(GalaxyWorkflowState.RUNNING, stateIds);
    when(analysisSubmissionRepository.findByAnalysisState(AnalysisState.RUNNING)).thenReturn(Arrays.asList(analysisSubmission));
    when(analysisExecutionService.getWorkflowStatus(analysisSubmission)).thenReturn(galaxyWorkflowStatus);
    analysisExecutionScheduledTask.monitorRunningAnalyses();
    assertEquals(AnalysisState.ERROR, analysisSubmission.getAnalysisState());
    verify(analysisSubmissionRepository).save(analysisSubmission);
}
Also used : Set(java.util.Set) GalaxyWorkflowState(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) Test(org.junit.Test)

Example 34 with GalaxyWorkflowStatus

use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus in project irida by phac-nml.

the class AnalysisExecutionScheduledTaskImplTest method testMonitorRunningAnalysesSuccessQueued.

/**
 * Tests successfully skipping over switching analysis state for a queued
 * analysis in Galaxy.
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowNotFoundException
 */
@Test
public void testMonitorRunningAnalysesSuccessQueued() throws ExecutionManagerException, IridaWorkflowNotFoundException {
    analysisSubmission.setAnalysisState(AnalysisState.RUNNING);
    Map<GalaxyWorkflowState, Set<String>> stateIds = Util.buildStateIdsWithStateFilled(GalaxyWorkflowState.QUEUED, Sets.newHashSet("1"));
    when(analysisSubmissionRepository.findByAnalysisState(AnalysisState.RUNNING)).thenReturn(Arrays.asList(analysisSubmission));
    when(analysisExecutionService.getWorkflowStatus(analysisSubmission)).thenReturn(new GalaxyWorkflowStatus(GalaxyWorkflowState.QUEUED, stateIds));
    analysisExecutionScheduledTask.monitorRunningAnalyses();
    assertEquals(AnalysisState.RUNNING, analysisSubmission.getAnalysisState());
    verify(analysisSubmissionRepository, never()).save(analysisSubmission);
}
Also used : Set(java.util.Set) GalaxyWorkflowState(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) Test(org.junit.Test)

Example 35 with GalaxyWorkflowStatus

use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus in project irida by phac-nml.

the class AnalysisExecutionScheduledTaskImplTest method testMonitorRunningAnalysesSuccessRunning.

/**
 * Tests successfully skipping over switching analysis state for a running
 * analysis in Galaxy.
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowNotFoundException
 */
@Test
public void testMonitorRunningAnalysesSuccessRunning() throws ExecutionManagerException, IridaWorkflowNotFoundException {
    analysisSubmission.setAnalysisState(AnalysisState.RUNNING);
    Map<GalaxyWorkflowState, Set<String>> stateIds = Util.buildStateIdsWithStateFilled(GalaxyWorkflowState.RUNNING, Sets.newHashSet("1"));
    when(analysisSubmissionRepository.findByAnalysisState(AnalysisState.RUNNING)).thenReturn(Arrays.asList(analysisSubmission));
    when(analysisExecutionService.getWorkflowStatus(analysisSubmission)).thenReturn(new GalaxyWorkflowStatus(GalaxyWorkflowState.RUNNING, stateIds));
    analysisExecutionScheduledTask.monitorRunningAnalyses();
    assertEquals(AnalysisState.RUNNING, analysisSubmission.getAnalysisState());
    verify(analysisSubmissionRepository, never()).save(analysisSubmission);
}
Also used : Set(java.util.Set) GalaxyWorkflowState(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) Test(org.junit.Test)

Aggregations

GalaxyWorkflowStatus (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus)36 Test (org.junit.Test)32 HistoryDetails (com.github.jmchilton.blend4j.galaxy.beans.HistoryDetails)18 WorkflowOutputs (com.github.jmchilton.blend4j.galaxy.beans.WorkflowOutputs)6 GalaxyWorkflowState (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState)5 List (java.util.List)5 Set (java.util.Set)5 History (com.github.jmchilton.blend4j.galaxy.beans.History)4 LinkedList (java.util.LinkedList)4 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)3 Dataset (com.github.jmchilton.blend4j.galaxy.beans.Dataset)3 ArrayList (java.util.ArrayList)3 TimeoutException (java.util.concurrent.TimeoutException)2 ExecutionManagerException (ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException)1 NoPercentageCompleteException (ca.corefacility.bioinformatics.irida.exceptions.NoPercentageCompleteException)1 AnalysisState (ca.corefacility.bioinformatics.irida.model.enums.AnalysisState)1 HistoryContentsProvenance (com.github.jmchilton.blend4j.galaxy.beans.HistoryContentsProvenance)1 ToolParameter (com.github.jmchilton.blend4j.galaxy.beans.ToolParameter)1 Path (java.nio.file.Path)1 Future (java.util.concurrent.Future)1