Repository: airavata
Updated Branches:
  refs/heads/master be901aa87 -> ea889993d


avoid creating duplicate taska


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ea889993
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ea889993
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ea889993

Branch: refs/heads/master
Commit: ea889993dc1cbfb4a7d89aee6a524cbb21d4cee3
Parents: be901aa
Author: Chathuri Wimalasena <[email protected]>
Authored: Tue Apr 14 11:55:57 2015 -0400
Committer: Chathuri Wimalasena <[email protected]>
Committed: Tue Apr 14 11:55:57 2015 -0400

----------------------------------------------------------------------
 .../cpi/impl/SimpleOrchestratorImpl.java        | 21 ++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ea889993/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
 
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
index 0a768bd..ee059a9 100644
--- 
a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
+++ 
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
@@ -92,14 +92,23 @@ public class SimpleOrchestratorImpl extends 
AbstractOrchestrator{
         try {
             Registry newRegistry = orchestratorContext.getNewRegistry();
             experiment = (Experiment) 
newRegistry.get(RegistryModelType.EXPERIMENT, experimentId);
+            List<WorkflowNodeDetails> workflowNodeDetailsList = 
experiment.getWorkflowNodeDetailsList();
+            if (workflowNodeDetailsList != null && 
!workflowNodeDetailsList.isEmpty()){
+                for (WorkflowNodeDetails wfn : workflowNodeDetailsList){
+                    List<TaskDetails> taskDetailsList = 
wfn.getTaskDetailsList();
+                    if (taskDetailsList != null && !taskDetailsList.isEmpty()){
+                        return taskDetailsList;
+                    }
+                }
+            }else {
+                WorkflowNodeDetails iDontNeedaNode = 
ExperimentModelUtil.createWorkflowNode("tempNode", null);
+                String nodeID = (String) 
newRegistry.add(ChildDataType.WORKFLOW_NODE_DETAIL, iDontNeedaNode, 
experimentId);
 
+                TaskDetails taskDetails = 
ExperimentModelUtil.cloneTaskFromExperiment(experiment);
+                taskDetails.setTaskID((String) 
newRegistry.add(ChildDataType.TASK_DETAIL, taskDetails, nodeID));
+                tasks.add(taskDetails);
+            }
 
-            WorkflowNodeDetails iDontNeedaNode = 
ExperimentModelUtil.createWorkflowNode("IDontNeedaNode", null);
-            String nodeID = (String) 
newRegistry.add(ChildDataType.WORKFLOW_NODE_DETAIL, iDontNeedaNode, 
experimentId);
-
-            TaskDetails taskDetails = 
ExperimentModelUtil.cloneTaskFromExperiment(experiment);
-            taskDetails.setTaskID((String) 
newRegistry.add(ChildDataType.TASK_DETAIL, taskDetails, nodeID));
-            tasks.add(taskDetails);
         } catch (Exception e) {
             throw new OrchestratorException("Error during creating a task");
         }

Reply via email to