Search in sources :

Example 71 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class DatabaseSetupGalaxyITService method setupPairSubmissionInDatabase.

/**
 * Sets up an {@link AnalysisSubmission} with a set of
 * {@link SequenceFilePair}s that have already been setup with samples.
 *
 * @param sequenceFilePairs
 *            The set of {@link SequenceFilePair}s to submit.
 * @param referenceFilePath
 *            The path to an input reference file for this test.
 * @param iridaWorkflowId
 *            The id of an irida workflow.
 * @param parameters
 *            The parameters to use.
 * @return An {@link AnalysisSubmission} which has been saved to the
 *         database.
 */
public AnalysisSubmission setupPairSubmissionInDatabase(Set<SequencingObject> sequenceFilePairs, Path referenceFilePath, Map<String, String> parameters, UUID iridaWorkflowId) {
    ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
    AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(sequenceFilePairs).referenceFile(referenceFile).inputParameters(parameters).build();
    analysisSubmissionService.create(submission);
    return analysisSubmissionRepository.findOne(submission.getId());
}
Also used : ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)

Example 72 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class TestDataFactory method constructAnalysisSubmission.

public static AnalysisSubmission constructAnalysisSubmission() {
    Set<SequencingObject> files = new HashSet<>();
    files.add(constructSingleEndSequenceFile());
    Long id = 5L;
    final ReferenceFile rf = new ReferenceFile(files.iterator().next().getFiles().iterator().next().getFile());
    rf.setId(id);
    AnalysisSubmission analysisSubmission = AnalysisSubmission.builder(UUID.randomUUID()).name("submission-" + id).inputFiles(files).referenceFile(rf).build();
    analysisSubmission.setId(id);
    analysisSubmission.setAnalysisState(AnalysisState.COMPLETED);
    try {
        analysisSubmission.setAnalysis(constructAnalysis());
    } catch (final AnalysisAlreadySetException e) {
        // this should *never* happen, we just constructed
        // AnalysisSubmission above.
        fail();
    }
    return analysisSubmission;
}
Also used : SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) AnalysisAlreadySetException(ca.corefacility.bioinformatics.irida.exceptions.AnalysisAlreadySetException) HashSet(java.util.HashSet)

Example 73 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisExecutionScheduledTaskImpl method postProcessResults.

/**
 * {@inheritDoc}
 */
@Override
public Set<Future<AnalysisSubmission>> postProcessResults() {
    synchronized (postProcessingLock) {
        logger.trace("Running postProcessResults");
        List<AnalysisSubmission> analysisSubmissions = analysisSubmissionRepository.findByAnalysisState(AnalysisState.TRANSFERRED);
        Set<Future<AnalysisSubmission>> submissions = Sets.newHashSet();
        for (AnalysisSubmission analysisSubmission : analysisSubmissions) {
            logger.debug("Post processing results for " + analysisSubmission);
            submissions.add(analysisExecutionService.postProcessResults(analysisSubmission));
        }
        return submissions;
    }
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Future(java.util.concurrent.Future)

Example 74 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisExecutionScheduledTaskImpl method transferAnalysesResults.

/**
 * {@inheritDoc}
 */
@Override
public Set<Future<AnalysisSubmission>> transferAnalysesResults() {
    synchronized (transferAnalysesResultsLock) {
        logger.trace("Running transferAnalysesResults");
        List<AnalysisSubmission> analysisSubmissions = analysisSubmissionRepository.findByAnalysisState(AnalysisState.FINISHED_RUNNING);
        Set<Future<AnalysisSubmission>> submissions = Sets.newHashSet();
        for (AnalysisSubmission analysisSubmission : analysisSubmissions) {
            logger.debug("Transferring results for " + analysisSubmission);
            try {
                submissions.add(analysisExecutionService.transferAnalysisResults(analysisSubmission));
            } catch (ExecutionManagerException | IOException | IridaWorkflowException e) {
                logger.error("Error transferring submission " + analysisSubmission, e);
            }
        }
        return submissions;
    }
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Future(java.util.concurrent.Future) IOException(java.io.IOException) ExecutionManagerException(ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException) IridaWorkflowException(ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowException)

Example 75 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisSubmissionCleanupServiceImpl method switchInconsistentSubmissionsToError.

/**
 * {@inheritDoc}
 */
@Override
@PreAuthorize("hasRole('ROLE_ADMIN')")
public int switchInconsistentSubmissionsToError() {
    if (ranSwitchInconsistentSubmissionsToError) {
        throw new RuntimeException("already ran this method once");
    } else {
        int numberSubmissionsSwitched = 0;
        ranSwitchInconsistentSubmissionsToError = true;
        for (AnalysisState state : inconsistentStates) {
            List<AnalysisSubmission> submissions = analysisSubmissionRepository.findByAnalysisState(state);
            for (AnalysisSubmission submission : submissions) {
                logger.error("AnalysisSubmission [id=" + submission.getId() + ", name=" + submission.getName() + ", state=" + submission.getAnalysisState() + "] left in inconsistent state.  Switching to " + AnalysisState.ERROR + ".");
                submission.setAnalysisState(AnalysisState.ERROR);
                analysisSubmissionRepository.save(submission);
                numberSubmissionsSwitched++;
            }
        }
        return numberSubmissionsSwitched;
    }
}
Also used : AnalysisState(ca.corefacility.bioinformatics.irida.model.enums.AnalysisState) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)183 Test (org.junit.Test)121 WithMockUser (org.springframework.security.test.context.support.WithMockUser)95 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)30 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)30 Path (java.nio.file.Path)25 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)23 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)20 Project (ca.corefacility.bioinformatics.irida.model.project.Project)19 History (com.github.jmchilton.blend4j.galaxy.beans.History)19 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)18 AnalysisOutputFile (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisOutputFile)18 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)18 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)18 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)15 User (ca.corefacility.bioinformatics.irida.model.user.User)15 EntityNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException)12 ExecutionManagerException (ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException)12 ProjectAnalysisSubmissionJoin (ca.corefacility.bioinformatics.irida.model.workflow.submission.ProjectAnalysisSubmissionJoin)12 ToolExecution (ca.corefacility.bioinformatics.irida.model.workflow.analysis.ToolExecution)11