Search in sources :

Example 6 with EndForEachNode

use of org.apache.airavata.workflow.model.graph.system.EndForEachNode in project airavata by apache.

the class XBayaUtil method findEndForEachFor.

/**
 * @param node
 * @return
 */
public static Node findEndForEachFor(ForEachNode node) {
    Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
    if (toNodes.size() != 1) {
        throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
    }
    Node middleNode = toNodes.iterator().next();
    List<DataPort> outputPorts = middleNode.getOutputPorts();
    for (DataPort dataPort : outputPorts) {
        if (dataPort.getToNodes().size() == 1) {
            Node possibleEndForEachNode = dataPort.getToNodes().get(0);
            if (possibleEndForEachNode instanceof EndForEachNode) {
                return possibleEndForEachNode;
            }
        }
    }
    throw new WorkflowRuntimeException("EndForEachNode not found");
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) Node(org.apache.airavata.workflow.model.graph.Node) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Example 7 with EndForEachNode

use of org.apache.airavata.workflow.model.graph.system.EndForEachNode in project airavata by apache.

the class WSGraphFactory method createNode.

/**
 * @see org.apache.airavata.workflow.model.graph.GraphFactory#createNode(org.xmlpull.infoset.XmlElement)
 */
public NodeImpl createNode(XmlElement nodeElement) throws GraphException {
    String type = nodeElement.attributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE);
    if (type == null) {
        // Old graphs don't have the namespace for the attribute.
        type = nodeElement.attributeValue(GraphSchema.NODE_TYPE_ATTRIBUTE);
    }
    NodeImpl node;
    if (GraphSchema.NODE_TYPE_WS.equals(type)) {
        node = new WSNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_STREAM_SOURCE.equals(type)) {
        node = new StreamSourceNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_WORKFLOW.equals(type)) {
        node = new WorkflowNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_INPUT.equals(type)) {
        node = new InputNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_OUTPUT.equals(type)) {
        node = new OutputNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_CONSTANT.equals(type)) {
        node = new ConstantNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_SPLIT.equals(type)) {
        node = new ForEachNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_MERGE.equals(type)) {
        node = new EndForEachNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_IF.equals(type)) {
        node = new IfNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDIF.equals(type)) {
        node = new EndifNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_DOWHILE.equals(type)) {
        node = new DoWhileNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDDOWHILE.equals(type)) {
        node = new EndDoWhileNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_MEMO.equals(type)) {
        node = new MemoNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_RECEIVE.equals(type)) {
        node = new ReceiveNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_BLOCK.equals(type)) {
        node = new BlockNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDBLOCK.equals(type)) {
        node = new EndBlockNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_INSTANCE.equals(type)) {
        node = new InstanceNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_TERMINATE.equals(type)) {
        node = new TerminateInstanceNode(nodeElement);
    } else {
        // Default is WsNode for backward compatibility.
        node = new WSNode(nodeElement);
    }
    return node;
}
Also used : BlockNode(org.apache.airavata.workflow.model.graph.system.BlockNode) EndBlockNode(org.apache.airavata.workflow.model.graph.system.EndBlockNode) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) ReceiveNode(org.apache.airavata.workflow.model.graph.system.ReceiveNode) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) InstanceNode(org.apache.airavata.workflow.model.graph.amazon.InstanceNode) TerminateInstanceNode(org.apache.airavata.workflow.model.graph.amazon.TerminateInstanceNode) EndDoWhileNode(org.apache.airavata.workflow.model.graph.system.EndDoWhileNode) DoWhileNode(org.apache.airavata.workflow.model.graph.system.DoWhileNode) IfNode(org.apache.airavata.workflow.model.graph.system.IfNode) EndifNode(org.apache.airavata.workflow.model.graph.system.EndifNode) MemoNode(org.apache.airavata.workflow.model.graph.system.MemoNode) StreamSourceNode(org.apache.airavata.workflow.model.graph.system.StreamSourceNode) EndBlockNode(org.apache.airavata.workflow.model.graph.system.EndBlockNode) ConstantNode(org.apache.airavata.workflow.model.graph.system.ConstantNode) EndDoWhileNode(org.apache.airavata.workflow.model.graph.system.EndDoWhileNode) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) TerminateInstanceNode(org.apache.airavata.workflow.model.graph.amazon.TerminateInstanceNode) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Example 8 with EndForEachNode

use of org.apache.airavata.workflow.model.graph.system.EndForEachNode in project airavata by apache.

the class EndForEachComponent method createNode.

/**
 * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
 */
@Override
public Node createNode(Graph graph) {
    EndForEachNode node = new EndForEachNode(graph);
    node.setName(NAME);
    node.setComponent(this);
    // Creates a unique ID for the node. This has to be after setName().
    node.createID();
    createPorts(node);
    return node;
}
Also used : EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Example 9 with EndForEachNode

use of org.apache.airavata.workflow.model.graph.system.EndForEachNode in project airavata by apache.

the class InterpreterUtil method findEndForEachFor.

/**
 * @param node
 * @return
 */
public static Node findEndForEachFor(ForEachNode node) {
    Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
    if (toNodes.size() != 1) {
        throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
    }
    Node middleNode = toNodes.iterator().next();
    List<DataPort> outputPorts = middleNode.getOutputPorts();
    for (DataPort dataPort : outputPorts) {
        if (dataPort.getToNodes().size() == 1) {
            Node possibleEndForEachNode = dataPort.getToNodes().get(0);
            if (possibleEndForEachNode instanceof EndForEachNode) {
                return possibleEndForEachNode;
            }
        }
    }
    throw new WorkflowRuntimeException("EndForEachNode not found");
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) Node(org.apache.airavata.workflow.model.graph.Node) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Aggregations

EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)9 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)8 Node (org.apache.airavata.workflow.model.graph.Node)6 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)6 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)3 DataPort (org.apache.airavata.workflow.model.graph.DataPort)3 BlockNode (org.apache.airavata.workflow.model.graph.system.BlockNode)3 ConstantNode (org.apache.airavata.workflow.model.graph.system.ConstantNode)3 EndBlockNode (org.apache.airavata.workflow.model.graph.system.EndBlockNode)3 EndifNode (org.apache.airavata.workflow.model.graph.system.EndifNode)3 IfNode (org.apache.airavata.workflow.model.graph.system.IfNode)3 MemoNode (org.apache.airavata.workflow.model.graph.system.MemoNode)3 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)3 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)2 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)2 ArrayList (java.util.ArrayList)1 DataType (org.apache.airavata.model.application.io.DataType)1 ComponentPort (org.apache.airavata.workflow.model.component.ComponentPort)1 WSComponentPort (org.apache.airavata.workflow.model.component.ws.WSComponentPort)1 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)1