Search in sources :

Example 11 with GalaxyWorkflowStatus

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

the class GalaxyWorkflowsIT method testExecuteCollectionsPairedList.

/**
 * Tests executing a collections paired list workflow.
 * @throws ExecutionManagerException
 */
@Test
public void testExecuteCollectionsPairedList() throws ExecutionManagerException {
    String workflowId = localGalaxy.getWorklowCollectionListId();
    String workflowInputLabel = localGalaxy.getWorkflowCollectionListLabel();
    List<Path> dataFilesForward = new LinkedList<Path>();
    dataFilesForward.add(dataFile1);
    dataFilesForward.add(dataFile2);
    List<Path> dataFilesReverse = new LinkedList<Path>();
    dataFilesReverse.add(dataFile3);
    dataFilesReverse.add(dataFile4);
    WorkflowOutputs workflowOutput = runSingleCollectionWorkflow(dataFilesForward, dataFilesReverse, FILE_TYPE, workflowId, workflowInputLabel);
    assertNotNull(workflowOutput);
    assertNotNull(workflowOutput.getHistoryId());
    // history should exist
    HistoryDetails historyDetails = historiesClient.showHistory(workflowOutput.getHistoryId());
    assertNotNull(historyDetails);
    // outputs should exist
    assertNotNull(workflowOutput.getOutputIds());
    assertEquals(1, workflowOutput.getOutputIds().size());
    String outputId = workflowOutput.getOutputIds().get(0);
    // output dataset should exist
    Dataset outputDataset = historiesClient.showDataset(workflowOutput.getHistoryId(), outputId);
    assertNotNull(outputDataset);
    // test get workflow status
    GalaxyWorkflowStatus workflowStatus = galaxyHistory.getStatusForHistory(workflowOutput.getHistoryId());
    float percentComplete = workflowStatus.getProportionComplete();
    assertTrue(0.0f <= percentComplete && percentComplete <= 1.0f);
}
Also used : Path(java.nio.file.Path) WorkflowOutputs(com.github.jmchilton.blend4j.galaxy.beans.WorkflowOutputs) HistoryDetails(com.github.jmchilton.blend4j.galaxy.beans.HistoryDetails) Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 12 with GalaxyWorkflowStatus

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

the class GalaxyWorkflowsIT method testExecuteWorkflowChangeToolParameter.

/**
 * Tests executing a single workflow in Galaxy and changing a single tool
 * parameter.
 *
 * @throws ExecutionManagerException
 */
@Test
public void testExecuteWorkflowChangeToolParameter() throws ExecutionManagerException {
    String toolId = "Grep1";
    String workflowId = localGalaxy.getSingleInputWorkflowId();
    String workflowInputLabel = localGalaxy.getSingleInputWorkflowLabel();
    Map<String, ToolParameter> toolParameters = ImmutableMap.of(toolId, new ToolParameter("pattern", "^#"));
    WorkflowOutputs workflowOutput = runSingleFileWorkflow(dataFile1, FILE_TYPE, workflowId, workflowInputLabel, toolParameters);
    assertNotNull("workflowOutput should not be null", workflowOutput);
    assertNotNull("workflowOutput history id should not be null", workflowOutput.getHistoryId());
    // history should exist
    HistoryDetails historyDetails = historiesClient.showHistory(workflowOutput.getHistoryId());
    assertNotNull("historyDetails for the history for the workflow should not be null", historyDetails);
    // outputs should exist
    assertNotNull("outputIds for the workflow should not be null", workflowOutput.getOutputIds());
    assertTrue("there should exist output dataset ids for the workflow", workflowOutput.getOutputIds().size() > 0);
    // each output dataset should exist
    for (String outputId : workflowOutput.getOutputIds()) {
        Dataset dataset = historiesClient.showDataset(workflowOutput.getHistoryId(), outputId);
        assertNotNull("the output dataset should exist", dataset);
        HistoryContentsProvenance provenance = historiesClient.showProvenance(workflowOutput.getHistoryId(), dataset.getId());
        if (toolId.equals(provenance.getToolId())) {
            Map<String, Object> parametersMap = provenance.getParameters();
            assertEquals("pattern parameter is correct", "\"^#\"", parametersMap.get("pattern"));
        }
    }
    // test get workflow status
    GalaxyWorkflowStatus workflowStatus = galaxyHistory.getStatusForHistory(workflowOutput.getHistoryId());
    float proportionComplete = workflowStatus.getProportionComplete();
    assertTrue("the workflow proportion complete should be between 0 and 1", 0.0f <= proportionComplete && proportionComplete <= 1.0f);
}
Also used : WorkflowOutputs(com.github.jmchilton.blend4j.galaxy.beans.WorkflowOutputs) HistoryDetails(com.github.jmchilton.blend4j.galaxy.beans.HistoryDetails) Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) ToolParameter(com.github.jmchilton.blend4j.galaxy.beans.ToolParameter) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) HistoryContentsProvenance(com.github.jmchilton.blend4j.galaxy.beans.HistoryContentsProvenance) Test(org.junit.Test)

Example 13 with GalaxyWorkflowStatus

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

the class GalaxyHistoriesServiceTest method testGetStatusRunningState.

/**
 * Tests getting status for a running workflow state.
 * @throws ExecutionManagerException
 */
@Test
public void testGetStatusRunningState() throws ExecutionManagerException {
    Map<String, List<String>> validStateIds = Util.buildStateIdsWithStateFilled("running", Arrays.asList("1", "2"));
    when(historiesClient.showHistory(VALID_HISTORY_ID)).thenReturn(historyDetails);
    when(historyDetails.getState()).thenReturn("running");
    when(historyDetails.getStateIds()).thenReturn(validStateIds);
    GalaxyWorkflowStatus status = galaxyHistory.getStatusForHistory(VALID_HISTORY_ID);
    assertEquals(GalaxyWorkflowState.RUNNING, status.getState());
    assertEquals("proportion complete is invalid", 0.0f, status.getProportionComplete(), delta);
}
Also used : ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) Test(org.junit.Test)

Example 14 with GalaxyWorkflowStatus

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

the class GalaxyHistoriesServiceTest method testGetStatusOkState.

/**
 * Tests getting status for a completed/ok workflow state.
 * @throws ExecutionManagerException
 */
@Test
public void testGetStatusOkState() throws ExecutionManagerException {
    Map<String, List<String>> validStateIds = Util.buildStateIdsWithStateFilled("ok", Arrays.asList("1", "2"));
    when(historiesClient.showHistory(VALID_HISTORY_ID)).thenReturn(historyDetails);
    when(historyDetails.getState()).thenReturn("ok");
    when(historyDetails.getStateIds()).thenReturn(validStateIds);
    GalaxyWorkflowStatus status = galaxyHistory.getStatusForHistory(VALID_HISTORY_ID);
    assertEquals(GalaxyWorkflowState.OK, status.getState());
    assertEquals("proprotion complete is invalid", 1.0f, status.getProportionComplete(), delta);
}
Also used : ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) Test(org.junit.Test)

Example 15 with GalaxyWorkflowStatus

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

the class AnalysisExecutionScheduledTaskImplTest method testMonitorRunningAnalysesSuccessError.

/**
 * Tests successfully switching an analysis to {@link AnalysisState.ERROR}
 * if there was an error Galaxy state.
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowNotFoundException
 */
@Test
public void testMonitorRunningAnalysesSuccessError() throws ExecutionManagerException, IridaWorkflowNotFoundException {
    analysisSubmission.setAnalysisState(AnalysisState.RUNNING);
    Map<GalaxyWorkflowState, Set<String>> stateIds = Util.buildStateIdsWithStateFilled(GalaxyWorkflowState.ERROR, Sets.newHashSet("1"));
    GalaxyWorkflowStatus galaxyWorkflowStatus = new GalaxyWorkflowStatus(GalaxyWorkflowState.ERROR, 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)

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