* *
*
* @param experimentId
*/
public boolean launchExperiment(String experimentId) throws TException {
Experiment experiment = null;
try {
List<String> ids = registry.getIds(
RegistryModelType.WORKFLOW_NODE_DETAIL,
WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
for (String workflowNodeId : ids) {
WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
.get(RegistryModelType.WORKFLOW_NODE_DETAIL,
workflowNodeId);
List<Object> taskDetailList = registry.get(
RegistryModelType.TASK_DETAIL,
TaskDetailConstants.NODE_ID, workflowNodeId);
for (Object o : taskDetailList) {
TaskDetails taskID = (TaskDetails) o;
// iterate through all the generated tasks and performs the
// job submisssion+monitoring
experiment = (Experiment) registry.get(
RegistryModelType.EXPERIMENT, experimentId);
if (experiment == null) {
log.error("Error retrieving the Experiment by the given experimentID: "
+ experimentId);
return false;
}
ExperimentStatus status = new ExperimentStatus();
status.setExperimentState(ExperimentState.LAUNCHED);
status.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
experiment.setExperimentStatus(status);
registry.update(RegistryModelType.EXPERIMENT, experiment,
experimentId);
// launching the experiment
orchestrator.launchExperiment(experiment,
workflowNodeDetail, taskID,null);
}
}
} catch (Exception e) {
// Here we really do not have to do much because only potential
// failure can happen
// is in gfac, if there are errors in gfac, it will handle the
// experiment/task/job statuses
// We might get failures in registry access before submitting the
// jobs to gfac, in that case we
// leave the status of these as created.
ExperimentStatus status = new ExperimentStatus();
status.setExperimentState(ExperimentState.FAILED);
status.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
experiment.setExperimentStatus(status);
try {
registry.update(RegistryModelType.EXPERIMENT, experiment,
experimentId);
} catch (RegistryException e1) {
throw new TException(e);