*/
public void executeExperiment(Experiment exp){
//1) Get the required data and build the request
//ExperimentExecutable already contains the input data
ExperimentExecutable executable = exp.getExperimentExecutable();
if( executable == null ) {
log.error("executeExperiment: executable is null!");
return;
}
//DECIDE UPON WHICH BATCH_QUEUE WAS CHOSEN WHAT PROCESSOR TO CALL
// Look for the batch system...
TestbedBatchProcessorManager tbBatchManager = TestbedBatchProcessorManager.getInstance();
BatchProcessor bp;
//a) TB-experiment types before version1.0 - these use the ExperimentWorkflow
if(executable.getBatchSystemIdentifier().equals(BatchProcessor.BATCH_IDENTIFIER_TESTBED_LOCAL)){
//get the specific batchProcessor implementation
bp = tbBatchManager.getBatchProcessor(BatchProcessor.BATCH_IDENTIFIER_TESTBED_LOCAL);
// Invoke, depending on the experiment type:
ExperimentWorkflow ewf = executable.getWorkflow();
log.info("Submitting workflow: "+ewf+" to batch processor: "+BatchProcessor.BATCH_IDENTIFIER_TESTBED_LOCAL);
log.info("Got inputs #"+executable.getInputData().size());
String queue_key = bp.submitBatch( exp.getEntityID(), ewf , executable.getInputData());
//already set: executable.setBatchQueueIdentifier(BatchProcessor.BATCH_QUEUE_TESTBED_LOCAL);
executable.setBatchExecutionIdentifier(queue_key);
executable.setExecutableInvoked(true);
executable.setExecutionCompleted(false);
log.info("Got key: "+queue_key);
}
//b) TB-experiment types using the wee batch processor
if(executable.getBatchSystemIdentifier().equals(BatchProcessor.BATCH_QUEUE_TESTBED_WEE_LOCAL)){
//get the specific batchProcessor implementation
bp = tbBatchManager.getBatchProcessor(BatchProcessor.BATCH_QUEUE_TESTBED_WEE_LOCAL);
log.info("Submitting workflow to batch processor: "+BatchProcessor.BATCH_QUEUE_TESTBED_WEE_LOCAL);
log.info("Got inputs #"+executable.getInputData().size());
//DataHandler dh = new DataHandlerImpl();
//NOTE: previously submitting digital objects...
//List<DigitalObject> digos = dh.convertFileRefsToURLAccessibleDigos(executable.getInputData());
//submit the batch process to the WEE
//String queue_key = bp.sumitBatch(exp.getEntityID(), digos, executable.getWEEWorkflowConfig());
//NOTE: changed to submitting by data registry references..
//submit the batch process to the WEE passing objects by reference (shared data registry pointers)
List<URI> digoRefs = new ArrayList<URI>();
for(String inputDataRef : executable.getInputData()){
try{
digoRefs.add(new URI(inputDataRef));
}catch(URISyntaxException err){
log.debug("this shouldn't happen - conversion String -> URI failed for "+inputDataRef);
}
}
String queue_key = bp.sumitBatchByReference(exp.getEntityID(), digoRefs, executable.getWEEWorkflowConfig());
if((queue_key!=null)&&(!queue_key.equals(""))){
executable.setBatchExecutionIdentifier(queue_key);
//executable.setExecutableInvoked(true);
executable.setExecutionCompleted(false);
log.info("Got key: "+queue_key);
}else{
//something on the batch processor went wrong....
//FIXME: This is not really sufficient... inform notify_failed?
executable.setExecutionCompleted(true);
executable.setExecutionSuccess(false);
}
}
}