Search in sources :

Example 36 with GalaxyWorkflowStatus

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

the class AnalysisExecutionScheduledTaskImpl method monitorRunningAnalyses.

/**
 * {@inheritDoc}
 */
@Override
public Set<Future<AnalysisSubmission>> monitorRunningAnalyses() {
    synchronized (monitorRunningAnalysesLock) {
        logger.trace("Running monitorRunningAnalyses");
        List<AnalysisSubmission> analysisSubmissions = analysisSubmissionRepository.findByAnalysisState(AnalysisState.RUNNING);
        Set<Future<AnalysisSubmission>> submissions = Sets.newHashSet();
        for (AnalysisSubmission analysisSubmission : analysisSubmissions) {
            logger.trace("Checking state of " + analysisSubmission);
            try {
                GalaxyWorkflowStatus workflowStatus = analysisExecutionService.getWorkflowStatus(analysisSubmission);
                submissions.add(handleWorkflowStatus(workflowStatus, analysisSubmission));
            } catch (ExecutionManagerException | RuntimeException e) {
                logger.error("Error checking state for " + analysisSubmission, e);
                analysisSubmission.setAnalysisState(AnalysisState.ERROR);
                submissions.add(new AsyncResult<>(analysisSubmissionRepository.save(analysisSubmission)));
            }
        }
        return submissions;
    }
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Future(java.util.concurrent.Future) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) AsyncResult(org.springframework.scheduling.annotation.AsyncResult) ExecutionManagerException(ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException)

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