use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState 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);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState in project irida by phac-nml.
the class AnalysisExecutionScheduledTaskImplTest method testMonitorRunningAnalysesSuccessFinished.
/**
* Tests successfully switching analysis state to
* {@link AnalysisState.FINISHED_RUNNING} on success in Galaxy.
*
* @throws ExecutionManagerException
* @throws IridaWorkflowNotFoundException
*/
@Test
public void testMonitorRunningAnalysesSuccessFinished() throws ExecutionManagerException, IridaWorkflowNotFoundException {
analysisSubmission.setAnalysisState(AnalysisState.RUNNING);
Map<GalaxyWorkflowState, Set<String>> stateIds = Util.buildStateIdsWithStateFilled(GalaxyWorkflowState.OK, Sets.newHashSet("1"));
GalaxyWorkflowStatus galaxyWorkflowStatus = new GalaxyWorkflowStatus(GalaxyWorkflowState.OK, stateIds);
when(analysisSubmissionRepository.findByAnalysisState(AnalysisState.RUNNING)).thenReturn(Arrays.asList(analysisSubmission));
when(analysisExecutionService.getWorkflowStatus(analysisSubmission)).thenReturn(galaxyWorkflowStatus);
analysisExecutionScheduledTask.monitorRunningAnalyses();
assertEquals(AnalysisState.FINISHED_RUNNING, analysisSubmission.getAnalysisState());
verify(analysisSubmissionRepository).save(analysisSubmission);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowState 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.GalaxyWorkflowState 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.GalaxyWorkflowState 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