use of ca.corefacility.bioinformatics.irida.service.analysis.annotations.RunAsUser in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyAsync method executeAnalysis.
/**
* Executes the passed prepared {@link AnalysisSubmission} in an execution
* manager.
*
* @param analysisSubmission
* The {@link AnalysisSubmission} to execute.
* @return A {@link Future} with an {@link AnalysisSubmission} for the
* analysis submitted.
* @throws ExecutionManagerException
* If there was an exception submitting the analysis to the
* execution manager.
* @throws IridaWorkflowException If there was an issue with the IRIDA workflow.
*/
@RunAsUser("#analysisSubmission.getSubmitter()")
public Future<AnalysisSubmission> executeAnalysis(AnalysisSubmission analysisSubmission) throws ExecutionManagerException, IridaWorkflowException {
checkNotNull(analysisSubmission, "analysisSubmission is null");
checkNotNull(analysisSubmission.getRemoteAnalysisId(), "remote analyis id is null");
checkNotNull(analysisSubmission.getWorkflowId(), "workflowId is null");
logger.debug("Running submission for " + analysisSubmission);
logger.trace("Preparing files for " + analysisSubmission);
PreparedWorkflowGalaxy preparedWorkflow = workspaceService.prepareAnalysisFiles(analysisSubmission);
WorkflowInputsGalaxy input = preparedWorkflow.getWorkflowInputs();
String libraryId = preparedWorkflow.getRemoteDataId();
logger.trace("Executing " + analysisSubmission);
galaxyWorkflowService.runWorkflow(input);
analysisSubmission.setAnalysisState(AnalysisState.RUNNING);
analysisSubmission.setRemoteInputDataId(libraryId);
analysisSubmission = analysisSubmissionService.update(analysisSubmission);
return new AsyncResult<>(analysisSubmission);
}
use of ca.corefacility.bioinformatics.irida.service.analysis.annotations.RunAsUser in project irida by phac-nml.
the class AnalysisSubmissionSampleProcessorImpl method updateSamples.
/**
* {@inheritDoc}
*/
@Override
@RunAsUser("#analysisSubmission.getSubmitter()")
@Transactional(propagation = Propagation.REQUIRES_NEW)
@PreAuthorize("hasPermission(#analysisSubmission, 'canUpdateSamplesFromAnalysisSubmission')")
public void updateSamples(AnalysisSubmission analysisSubmission) throws PostProcessingException {
if (!analysisSubmission.getUpdateSamples()) {
logger.trace("Will not update samples from results for submission=" + analysisSubmission);
} else {
logger.debug("Updating sample from results for submission=" + analysisSubmission);
Set<Sample> samples = sampleRepository.findSamplesForAnalysisSubmission(analysisSubmission);
Analysis analysis = analysisSubmission.getAnalysis();
checkNotNull(analysis, "No analysis associated with submission " + analysisSubmission);
checkNotNull(samples, "No samples associated with submission " + analysisSubmission);
AnalysisSampleUpdater analysisSampleUpdaterService = analysisSampleUpdaterMap.get(analysis.getAnalysisType());
if (analysisSampleUpdaterService != null) {
// re-reading submission to ensure file paths are correct
analysisSubmission = analysisSubmissionService.read(analysisSubmission.getId());
analysisSampleUpdaterService.update(samples, analysisSubmission);
} else {
logger.debug("No associated object for updating samples for analysis of type " + analysis.getAnalysisType());
}
}
}
Aggregations