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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations