airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [02/16] airavata git commit: Fixed issues with workflow runtime model build
Date Wed, 24 Feb 2016 20:08:08 GMT
Fixed issues with workflow runtime model build


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

Branch: refs/heads/master
Commit: c72a90ed41ce6c8a0f1a02cd43e8afc341f92ad2
Parents: 3a9a18a
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Mon Feb 22 11:24:23 2016 -0500
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Mon Feb 22 11:24:23 2016 -0500

----------------------------------------------------------------------
 .../airavata/workflow/core/WorkflowInfo.java    | 38 ++++++++++++--------
 .../workflow/core/dag/edge/DirectedEdge.java    | 12 +++----
 .../workflow/core/dag/nodes/InputNodeImpl.java  |  6 ++--
 .../workflow/core/dag/nodes/OutputNodeImpl.java | 12 ++++---
 .../core/parser/JsonWorkflowParser.java         | 31 +++++++++++++---
 .../src/test/resources/TestWorkflow.json        | 16 ++++-----
 6 files changed, 74 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/c72a90ed/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowInfo.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowInfo.java
b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowInfo.java
index a0dd859..082d455 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowInfo.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowInfo.java
@@ -20,14 +20,22 @@
  */
 package org.apache.airavata.workflow.core;
 
+import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNode;
+import org.apache.airavata.workflow.core.dag.nodes.WorkflowNode;
+
+import java.util.List;
+
 public class WorkflowInfo {
     private String name;
     private String id;
     private String description;
     private String version;
-    private int applicationCount;
-    private int inputCount;
-    private int outputCount;
+    private List<InputNode> inputs;
+    private List<OutputNode> outputs;
+    private List<ApplicationNode> applications;
+
 
     public String getName() {
         return name;
@@ -61,27 +69,27 @@ public class WorkflowInfo {
         this.version = version;
     }
 
-    public int getApplicationCount() {
-        return applicationCount;
+    public List<InputNode> getInputs() {
+        return inputs;
     }
 
-    public void setApplicationCount(int applicationCount) {
-        this.applicationCount = applicationCount;
+    public void setInputs(List<InputNode> inputs) {
+        this.inputs = inputs;
     }
 
-    public int getInputCount() {
-        return inputCount;
+    public List<OutputNode> getOutputs() {
+        return outputs;
     }
 
-    public void setInputCount(int inputCount) {
-        this.inputCount = inputCount;
+    public void setOutputs(List<OutputNode> outputs) {
+        this.outputs = outputs;
     }
 
-    public int getOutputCount() {
-        return outputCount;
+    public List<ApplicationNode> getApplications() {
+        return applications;
     }
 
-    public void setOutputCount(int outputCount) {
-        this.outputCount = outputCount;
+    public void setApplications(List<ApplicationNode> applications) {
+        this.applications = applications;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/c72a90ed/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/edge/DirectedEdge.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/edge/DirectedEdge.java
b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/edge/DirectedEdge.java
index e8b7f07..e022eff 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/edge/DirectedEdge.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/edge/DirectedEdge.java
@@ -28,8 +28,8 @@ import org.apache.airavata.workflow.core.dag.port.OutPort;
 
 public class DirectedEdge implements Edge {
 
-    private InPort inPort;
-    private OutPort outPort;
+    private InPort toPort;
+    private OutPort fromPort;
     private EdgeModel edgeModel;
 
     public DirectedEdge(EdgeModel edgeModel) {
@@ -53,21 +53,21 @@ public class DirectedEdge implements Edge {
 
     @Override
     public InPort getToPort() {
-        return inPort;
+        return toPort;
     }
 
     @Override
     public void setToPort(InPort inPort) {
-        this.inPort = inPort;
+        this.toPort = inPort;
     }
 
     @Override
     public OutPort getFromPort() {
-        return outPort;
+        return fromPort;
     }
 
     @Override
     public void setFromPort(OutPort outPort) {
-        this.outPort = outPort;
+        this.fromPort = outPort;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/c72a90ed/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
index e8e46e5..1019787 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
@@ -119,9 +119,9 @@ public class InputNodeImpl implements InputNode {
             inputDataObjectType = new InputDataObjectType(getName());
             inputDataObjectType.setValue(getValue());
             inputDataObjectType.setType(getDataType());
-            inputDataObjectType.setIsRequired(true);
-            inputDataObjectType.setDataStaged(true);
-            inputDataObjectType.setInputOrder(0);
+//            inputDataObjectType.setIsRequired(true);
+//            inputDataObjectType.setDataStaged(true);
+//            inputDataObjectType.setInputOrder(0);
         }
         return inputDataObjectType;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/c72a90ed/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
index d4c8780..5b56b50 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
@@ -153,10 +153,14 @@ public class OutputNodeImpl implements OutputNode {
     }
 
     private OutputDataObjectType convert(InputDataObjectType inputObject) {
-        OutputDataObjectType output = new OutputDataObjectType(getName());
-        output.setValue(inputObject.getValue());
-        output.setType(inputObject.getType());
-        return output;
+        if (inputObject != null) {
+            OutputDataObjectType output = new OutputDataObjectType(getName());
+            output.setValue(inputObject.getValue());
+            output.setType(inputObject.getType());
+            return output;
+
+        }
+        return null;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/airavata/blob/c72a90ed/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
index 37e82c0..1f1e000 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
@@ -24,6 +24,8 @@ package org.apache.airavata.workflow.core.parser;
 import com.google.gson.JsonObject;
 import com.google.gson.stream.JsonReader;
 import com.google.gson.stream.JsonToken;
+import org.apache.airavata.model.ComponentState;
+import org.apache.airavata.model.ComponentStatus;
 import org.apache.airavata.model.EdgeModel;
 import org.apache.airavata.model.NodeModel;
 import org.apache.airavata.model.PortModel;
@@ -116,6 +118,9 @@ public class JsonWorkflowParser implements WorkflowParser {
         jsonReader.endObject();
 
         buildWorkflowGraph();
+        workflowInfo.setInputs(inputs);
+        workflowInfo.setApplications(applications);
+        workflowInfo.setOutputs(outputs);
         return workflowInfo;
     }
 
@@ -143,7 +148,7 @@ public class JsonWorkflowParser implements WorkflowParser {
                 for (Map.Entry<String, Edge> entry : edgeMap.entrySet()) {
                     InPort inPort = nodeInportMap.get(entry.getKey());
                     if (inPort != null) {
-                        inPort.addEdge(entry.getValue());
+//                        inPort.addEdge(entry.getValue());
                         entry.getValue().setToPort(inPort);
 
                         queue.add(inPort.getNode());
@@ -159,7 +164,7 @@ public class JsonWorkflowParser implements WorkflowParser {
                     for (Map.Entry<String, Edge> entry : edgeMap.entrySet()) {
                         InPort inPort = nodeInportMap.get(entry.getKey());
                         if (inPort != null) {
-                            inPort.addEdge(entry.getValue());
+//                            inPort.addEdge(entry.getValue());
                             entry.getValue().setToPort(inPort);
 
                             queue.add(inPort.getNode());
@@ -216,7 +221,7 @@ public class JsonWorkflowParser implements WorkflowParser {
             for (Link link : links) {
                 EdgeModel edgeModel = new EdgeModel(link.getId());
                 Edge edge = new DirectedEdge(edgeModel);
-                edge.setFromPort(outPort);
+//                edge.setFromPort(outPort);
                 outPort.addEdge(edge);
                 inPortMap.put(link.getTo().getNodeId() + "," + link.getTo().getPortId(),
edge);
             }
@@ -284,6 +289,7 @@ public class JsonWorkflowParser implements WorkflowParser {
         JsonToken peek = jsonReader.peek();
         InputNode inputNode;
         NodeModel nodeModel;
+        ComponentStatus status;
         String name;
         if (peek == JsonToken.NULL) {
             throw new ParserException("Error! workflow inputs can't be null");
@@ -292,6 +298,10 @@ public class JsonWorkflowParser implements WorkflowParser {
             while (jsonReader.hasNext()) {
                 jsonReader.beginObject();
                 nodeModel = new NodeModel();
+                status = new ComponentStatus();
+                status.setState(ComponentState.CREATED);
+                status.setReason("Created");
+                nodeModel.setStatus(status);
                 inputNode = new InputNodeImpl(nodeModel);
                 while (jsonReader.hasNext()) {
                     name = jsonReader.nextName();
@@ -306,7 +316,8 @@ public class JsonWorkflowParser implements WorkflowParser {
                     } else if (name.equals(POSITION)) {
                         readPosition(jsonReader);
                     } else if (name.equals(NODE_ID)) {
-                        nodeModel.setNodeId(jsonReader.nextString());
+                        jsonReader.skipValue();
+//                        nodeModel.setNodeId(jsonReader.nextString());
                     } else if (name.equals(DEFAULT_VALUE)) {
                         inputNode.setValue(jsonReader.nextString());
                     } else {
@@ -327,6 +338,7 @@ public class JsonWorkflowParser implements WorkflowParser {
         JsonToken peek = jsonReader.peek();
         OutputNode outputNode;
         NodeModel nodeModel;
+        ComponentStatus status;
         String name;
         if (peek == JsonToken.NULL) {
             throw new ParserException("Error! workflow outputs can't be null");
@@ -335,6 +347,10 @@ public class JsonWorkflowParser implements WorkflowParser {
             while (jsonReader.hasNext()) {
                 jsonReader.beginObject();
                 nodeModel = new NodeModel();
+                status = new ComponentStatus();
+                status.setState(ComponentState.CREATED);
+                status.setReason("Created");
+                nodeModel.setStatus(status);
                 outputNode = new OutputNodeImpl(nodeModel);
                 while (jsonReader.hasNext()) {
                     name = jsonReader.nextName();
@@ -349,7 +365,8 @@ public class JsonWorkflowParser implements WorkflowParser {
                     } else if (name.equals(POSITION)) {
                         readPosition(jsonReader);
                     } else if (name.equals(NODE_ID)) {
-                        nodeModel.setNodeId(jsonReader.nextString());
+                        jsonReader.skipValue();
+//                        nodeModel.setNodeId(jsonReader.nextString());
                     } else if (name.equals(DEFAULT_VALUE)) {
                         jsonReader.skipValue();
                     } else {
@@ -427,6 +444,10 @@ public class JsonWorkflowParser implements WorkflowParser {
     private ApplicationNode readApplication(JsonReader jsonReader) throws IOException, ParserException
{
         jsonReader.beginObject();
         NodeModel nodeModel = new NodeModel();
+        ComponentStatus status = new ComponentStatus();
+        status.setState(ComponentState.CREATED);
+        status.setReason("Created");
+        nodeModel.setStatus(status);
         ApplicationNode applicationNode = new ApplicationNodeImpl(nodeModel);
         String name;
         while (jsonReader.hasNext()) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/c72a90ed/modules/workflow/workflow-core/src/test/resources/TestWorkflow.json
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/test/resources/TestWorkflow.json b/modules/workflow/workflow-core/src/test/resources/TestWorkflow.json
index d9c3a0c..c82a405 100644
--- a/modules/workflow/workflow-core/src/test/resources/TestWorkflow.json
+++ b/modules/workflow/workflow-core/src/test/resources/TestWorkflow.json
@@ -70,20 +70,20 @@
     "links" : [
       { "id" : "link_1",
         "description" : "link desc",
-        "from" : { "nodeId" : "" , "outputId" : "" },
-        "to" : { "nodeId" : "" , "inputId" : "" }},
+        "from" : { "nodeId" : "inputNode_Id_1" , "outputId" : "inputNode_Id_1" },
+        "to" : { "nodeId" : "applicationNodeId" , "inputId" : "appInputNode_Id_1" }},
       { "id" : "link_2",
         "description" : "link desc",
-        "from" : { "nodeId" : "" , "outputId" : "" },
-        "to" : { "nodeId" : "" , "inputId" : "" }},
+        "from" : { "nodeId" : "inputNode_Id_2" , "outputId" : "inputNode_Id_2" },
+        "to" : { "nodeId" : "applicationNodeId" , "inputId" : "appInputNode_Id_2" }},
       { "id" : "link_3",
         "description" : "link desc",
-        "from" : { "nodeId" : "" , "outputId" : "" },
-        "to" : { "nodeId" : "" , "inputId" : "" }},
+        "from" : { "nodeId" : "applicationNodeId" , "outputId" : "appOutputNode_Id_1" },
+        "to" : { "nodeId" : "outputNode_Id_1" , "inputId" : "outputNode_Id_1" }},
       { "id" : "link_4",
         "description" : "link desc",
-        "from" : { "nodeId" : "" , "outputId" : "" },
-        "to" : { "nodeId" : "" , "inputId" : "" }}
+        "from" : { "nodeId" : "applicationNodeId" , "outputId" : "appOutputNode_Id_2" },
+        "to" : { "nodeId" : "outputNode_Id_2" , "inputId" : "outputNode_Id_2" }}
     ]
   }
 }


Mime
View raw message