airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [01/14] airavata git commit: Added simple workflow module to the repository, defined basic APIs
Date Wed, 18 Feb 2015 22:04:59 GMT
Repository: airavata
Updated Branches:
  refs/heads/new-workflow-design [created] 1a5daae1a


Added simple workflow module to the repository, defined basic APIs


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

Branch: refs/heads/new-workflow-design
Commit: d7e2abba6e7572da057e869d033229720f3e76f4
Parents: 18f338c
Author: shamrath <shameerainfo@gmail.com>
Authored: Thu Jan 29 20:42:49 2015 -0500
Committer: shamrath <shameerainfo@gmail.com>
Committed: Thu Jan 29 20:42:49 2015 -0500

----------------------------------------------------------------------
 modules/simple-workflow/pom.xml                 | 12 ++++
 .../workflow/engine/SimpleWorkflowEngine.java   | 25 ++++++++
 .../engine/SimpleWorkflowInterpreter.java       | 56 +++++++++++++++++
 .../workflow/engine/dag/links/DirectedLink.java | 36 +++++++++++
 .../simple/workflow/engine/dag/links/Link.java  | 14 +++++
 .../engine/dag/nodes/ApplicationNode.java       | 66 ++++++++++++++++++++
 .../workflow/engine/dag/nodes/NodeState.java    | 12 ++++
 .../workflow/engine/dag/nodes/NodeType.java     | 10 +++
 .../engine/dag/nodes/WorkflowInputNode.java     | 35 +++++++++++
 .../workflow/engine/dag/nodes/WorkflowNode.java | 16 +++++
 .../engine/dag/nodes/WorkflowOutputNode.java    | 36 +++++++++++
 pom.xml                                         |  1 +
 12 files changed, 319 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/pom.xml
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/pom.xml b/modules/simple-workflow/pom.xml
new file mode 100644
index 0000000..c54ab83
--- /dev/null
+++ b/modules/simple-workflow/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.airavata</groupId>
+    <artifactId>simple-workflow</artifactId>
+    <version>0.15-SNAPSHOT</version>
+
+    
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
new file mode 100644
index 0000000..5a61874
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
@@ -0,0 +1,25 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.ariavata.simple.workflow.engine;
+
+public class SimpleWorkflowEngine{
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
new file mode 100644
index 0000000..b7bb261
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.ariavata.simple.workflow.engine;
+
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowInputNode;
+
+import java.util.List;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public class SimpleWorkflowInterpreter {
+
+
+    public SimpleWorkflowInterpreter(Experiment experiment, String credentialStoreToken)
{
+        // read the workflow file and build the topology to a DAG. Then execute that dag
+        // get workflowInputNode list and start processing
+        // next() will return ready task and block the thread if no task in ready state.
+    }
+
+    /**
+     * This method block the calling thread until next task is ready to return;
+     *
+     * @return nest task to launch;
+     */
+    public TaskDetails next() {
+        return null;
+    }
+
+    private List<WorkflowInputNode> parseWorkflowDescription(){
+        return null;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/DirectedLink.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/DirectedLink.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/DirectedLink.java
new file mode 100644
index 0000000..f28fec6
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/DirectedLink.java
@@ -0,0 +1,36 @@
+package org.apache.ariavata.simple.workflow.engine.dag.links;
+
+import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowNode;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public class DirectedLink implements Link{
+
+    private WorkflowNode _fromNode;
+
+    private WorkflowNode _toNode;
+
+    public DirectedLink(WorkflowNode _fromNode, WorkflowNode _toNode) {
+        this._fromNode = _fromNode;
+        this._toNode = _toNode;
+    }
+
+    @Override
+    public WorkflowNode fromNode() {
+        return null;
+    }
+
+    @Override
+    public WorkflowNode toNode() {
+        return null;
+    }
+
+    public void set_fromNode(WorkflowNode _fromNode) {
+        this._fromNode = _fromNode;
+    }
+
+    public void set_toNode(WorkflowNode _toNode) {
+        this._toNode = _toNode;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/Link.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/Link.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/Link.java
new file mode 100644
index 0000000..0406b13
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/links/Link.java
@@ -0,0 +1,14 @@
+package org.apache.ariavata.simple.workflow.engine.dag.links;
+
+import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowNode;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public interface Link {
+
+    public WorkflowNode fromNode();
+
+    public WorkflowNode toNode();
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java
new file mode 100644
index 0000000..d0dbf8d
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java
@@ -0,0 +1,66 @@
+package org.apache.ariavata.simple.workflow.engine.dag.nodes;
+
+import org.apache.ariavata.simple.workflow.engine.dag.links.Link;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public class ApplicationNode implements WorkflowNode {
+
+    private final String nodeId;
+    private NodeState myState = NodeState.WAITING;
+    private List<Link> inputLinks = new ArrayList<Link>();
+    private List<Link> outputLinks = new ArrayList<Link>();
+
+    public ApplicationNode(String nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    public String getNodeId() {
+        return this.nodeId;
+    }
+
+    @Override
+    public NodeType getNodeType() {
+        return NodeType.APPLICATION;
+    }
+
+    @Override
+    public NodeState getNodeState() {
+        return myState;
+    }
+
+    @Override
+    public void setNodeState(NodeState newNodeState) {
+        // TODO: node state can't be reversed , correct order WAITING --> READY -->
EXECUTING --> EXECUTED --> COMPLETE
+        myState = newNodeState;
+    }
+
+    public List<Link> getInputLinks() {
+        return inputLinks;
+    }
+
+    public List<Link> getOutputLinks() {
+        return outputLinks;
+    }
+
+    public void setInputLinks(List<Link> inputLinks) {
+        this.inputLinks = inputLinks;
+    }
+
+    public void setOutputLinks(List<Link> outputLinks) {
+        this.outputLinks = outputLinks;
+    }
+
+    public void addInputLink(Link inputLink) {
+        inputLinks.add(inputLink);
+    }
+
+    public void addOutputLink(Link outputLink) {
+        outputLinks.add(outputLink);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java
new file mode 100644
index 0000000..1442c80
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java
@@ -0,0 +1,12 @@
+package org.apache.ariavata.simple.workflow.engine.dag.nodes;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public enum NodeState {
+    WAITING, // waiting on inputs
+    READY, // all inputs are available and ready to execute
+    EXECUTING, // task has been submitted , not yet finish
+    EXECUTED, // task executed
+    COMPLETE // all works done
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java
new file mode 100644
index 0000000..cfb7c3d
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java
@@ -0,0 +1,10 @@
+package org.apache.ariavata.simple.workflow.engine.dag.nodes;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public enum NodeType {
+    APPLICATION,
+    WORKFLOW_INPUT,
+    WORKFLOW_OUTPUT
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java
new file mode 100644
index 0000000..8f29f5d
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java
@@ -0,0 +1,35 @@
+package org.apache.ariavata.simple.workflow.engine.dag.nodes;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public class WorkflowInputNode implements WorkflowNode {
+
+    private NodeState myState = NodeState.READY;
+    private final String nodeId;
+
+    public WorkflowInputNode(String nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    public String getNodeId() {
+        return null;
+    }
+
+    @Override
+    public NodeType getNodeType() {
+        return NodeType.WORKFLOW_INPUT;
+    }
+
+    @Override
+    public NodeState getNodeState() {
+        return myState;
+    }
+
+    @Override
+    public void setNodeState(NodeState newNodeState) {
+        // TODO: node state can't be reversed , correct order WAITING --> READY -->
EXECUTING --> EXECUTED --> COMPLETE
+        myState = newNodeState;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java
new file mode 100644
index 0000000..b2ba704
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java
@@ -0,0 +1,16 @@
+package org.apache.ariavata.simple.workflow.engine.dag.nodes;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public interface WorkflowNode {
+
+    public String getNodeId();
+
+    public NodeType getNodeType();
+
+    public NodeState getNodeState();
+
+    public void setNodeState(NodeState newNodeState);
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java
new file mode 100644
index 0000000..54f93b4
--- /dev/null
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java
@@ -0,0 +1,36 @@
+package org.apache.ariavata.simple.workflow.engine.dag.nodes;
+
+/**
+ * Created by shameera on 1/29/15.
+ */
+public class WorkflowOutputNode implements WorkflowNode {
+
+    private NodeState myState = NodeState.WAITING;
+    private final String nodeId;
+
+    public WorkflowOutputNode(String nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    public String getNodeId() {
+        return null;
+    }
+
+    @Override
+    public NodeType getNodeType() {
+        return NodeType.WORKFLOW_OUTPUT;
+    }
+
+    @Override
+    public NodeState getNodeState() {
+        return myState;
+    }
+
+    @Override
+    public void setNodeState(NodeState newNodeState) {
+        // TODO: node state can't be reversed , correct order WAITING --> READY -->
EXECUTING --> EXECUTED --> COMPLETE
+        myState = newNodeState;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d7e2abba/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ebc35a1..1e6218e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -524,6 +524,7 @@
 				<module>modules/ws-messenger</module>
 				<module>modules/messaging</module>
 				<module>modules/integration-tests</module>
+				<module>modules/simple-workflow</module>
 				<module>modules/xbaya-gui</module>
 			</modules>
 		</profile>


Mime
View raw message