You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/04/15 22:48:52 UTC

[16/28] airavata git commit: avoid creating duplicate taska

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/emailMonitoring
Commit: ea889993dc1cbfb4a7d89aee6a524cbb21d4cee3
Parents: be901aa
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Apr 14 11:55:57 2015 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
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");
         }