airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: avoid creating duplicate taska
Date Tue, 14 Apr 2015 15:56:06 GMT
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 <kamalasini@gmail.com>
Authored: Tue Apr 14 11:55:57 2015 -0400
Committer: Chathuri Wimalasena <kamalasini@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");
         }


Mime
View raw message