Search in sources :

Example 11 with OutputNode

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

the class WSGraphFactory method createNode.

public NodeImpl createNode(JsonObject nodeObject) throws GraphException {
    String type = nodeObject.getAsJsonPrimitive(GraphSchema.NODE_TYPE_ATTRIBUTE).getAsString();
    NodeImpl node;
    if (GraphSchema.NODE_TYPE_WS.equals(type)) {
        node = new WSNode(nodeObject);
    } else if (GraphSchema.NODE_TYPE_WORKFLOW.equals(type)) {
        node = new WorkflowNode(nodeObject);
    } else if (GraphSchema.NODE_TYPE_INPUT.equals(type)) {
        node = new InputNode(nodeObject);
    } else if (GraphSchema.NODE_TYPE_OUTPUT.equals(type)) {
        node = new OutputNode(nodeObject);
    /*        } else if (GraphSchema.NODE_TYPE_STREAM_SOURCE.equals(type)) {
            node = new StreamSourceNode(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(nodeObject);
    }
    return node;
}
Also used : InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl)

Example 12 with OutputNode

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

the class OutputComponent method createNode.

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

Example 13 with OutputNode

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

the class JythonScript method writeOutput.

private void writeOutput(OutputNode node, PrintWriter pw) throws GraphException {
    String id = node.getID();
    Port port = node.getPort();
    Node fromNode = port.getFromNode();
    if (fromNode == null) {
        throw new GraphException("Output parameter has to be connected to some node.");
    }
    Port fromPort = port.getFromPort();
    if (fromNode instanceof InputNode) {
        // The OutputNode is directly connected to an InputNode.
        pw.println(TAB + id + VALUE_SUFFIX + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + fromNode.getID() + "')");
    } else {
        pw.println(TAB + "# Wait output " + id);
        pw.println(TAB + id + VALUE_SUFFIX + " = " + fromNode.getID() + INVOKER_SUFFIX + "." + GET_OUTPUT_METHOD + "('" + fromPort.getName() + "')");
    }
    pw.println(TAB + "print '" + id + " = ', " + id + VALUE_SUFFIX);
    // This might try to remove a node that has been removed
    // already, but it's OK.
    this.executingNodes.remove(fromNode);
    pw.println();
}
Also used : GraphException(org.apache.airavata.workflow.model.graph.GraphException) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) Port(org.apache.airavata.workflow.model.graph.Port) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) IfNode(org.apache.airavata.workflow.model.graph.system.IfNode) MemoNode(org.apache.airavata.workflow.model.graph.system.MemoNode) Node(org.apache.airavata.workflow.model.graph.Node) WSNode(org.apache.airavata.workflow.model.graph.ws.WSNode) ConstantNode(org.apache.airavata.workflow.model.graph.system.ConstantNode) EndifNode(org.apache.airavata.workflow.model.graph.system.EndifNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode)

Example 14 with OutputNode

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

the class JythonScript method writeFooter.

/**
 * @param pw
 */
private void writeFooter(PrintWriter pw) {
    // Send a COMPLETE_WORKFLOW notification.
    pw.println(TAB + NOTIFICATION_VARIABLE + "." + WORKFLOW_COMPLETED_METHOD + "(");
    boolean first = true;
    for (OutputNode node : this.outputNodes) {
        if (first) {
            first = false;
        } else {
            pw.println(",");
        }
        String id = node.getID();
        pw.print(TAB + TAB + id + "=" + id + VALUE_SUFFIX);
    }
    pw.println(")");
    pw.println(TAB + "print 'Everything is done successfully.'");
    pw.println();
    pw.println("except Throwable, e:");
    pw.println(TAB + "print 'Error: ', e");
    pw.println(TAB + NOTIFICATION_VARIABLE + "." + WORKFLOW_INCOMPLETED_METHOD + "(e)");
}
Also used : OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode)

Aggregations

OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)14 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)8 ConstantNode (org.apache.airavata.workflow.model.graph.system.ConstantNode)4 EndifNode (org.apache.airavata.workflow.model.graph.system.EndifNode)4 IfNode (org.apache.airavata.workflow.model.graph.system.IfNode)4 MemoNode (org.apache.airavata.workflow.model.graph.system.MemoNode)4 ArrayList (java.util.ArrayList)3 Node (org.apache.airavata.workflow.model.graph.Node)3 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)3 BlockNode (org.apache.airavata.workflow.model.graph.system.BlockNode)3 EndBlockNode (org.apache.airavata.workflow.model.graph.system.EndBlockNode)3 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)3 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)3 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)3 GraphException (org.apache.airavata.workflow.model.graph.GraphException)2 URL (java.net.URL)1 LinkedList (java.util.LinkedList)1 Client (org.apache.airavata.api.Airavata.Client)1 InputDataObjectType (org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType)1 OutputDataObjectType (org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType)1