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