Search in sources :

Example 51 with DataPort

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

the class GraphImpl method fixParameterNodes.

// private void createID() {
// Date date = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss_S");
// String time = format.format(date);
// 
// this.id = StringUtil.convertToJavaIdentifier(this.name) + "_" + time;
// }
/**
 * @throws GraphException
 */
public void fixParameterNodes() {
    // XXX fix the ports of parameter nodes for 2.6.3 or before.
    for (InputNode node : GraphUtil.getNodes(this, InputNode.class)) {
        DataPort oldPort = node.getOutputPort(0);
        if (oldPort instanceof WSPort) {
            node.getOutputPorts().remove(oldPort);
            this.ports.remove(oldPort);
            SystemDataPort newPort = new SystemDataPort();
            this.ports.add(newPort);
            newPort.setKind(Kind.DATA_OUT);
            newPort.setName(oldPort.getName());
            newPort.setGraph(this);
            newPort.setNode(node);
            newPort.createID();
            node.getOutputPorts().add(newPort);
            for (DataEdge edge : oldPort.getEdges()) {
                edge.setFromPort(newPort);
                newPort.getEdges().add(edge);
            }
        }
    }
    for (OutputNode node : GraphUtil.getNodes(this, OutputNode.class)) {
        DataPort oldPort = node.getInputPort(0);
        if (oldPort instanceof WSPort) {
            node.getInputPorts().remove(oldPort);
            this.ports.remove(oldPort);
            SystemDataPort newPort = new SystemDataPort();
            this.ports.add(newPort);
            newPort.setKind(Kind.DATA_IN);
            newPort.setName(oldPort.getName());
            newPort.setGraph(this);
            newPort.setNode(node);
            newPort.createID();
            node.getInputPorts().add(newPort);
            for (DataEdge edge : oldPort.getEdges()) {
                edge.setToPort(newPort);
                newPort.getEdges().add(edge);
            }
        }
    }
}
Also used : SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort)

Example 52 with DataPort

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

the class NodeGUI method setToken.

/**
 * @param workflowName
 * @param state
 */
public void setToken(String workflowName, NodeState state) {
    List<DataPort> inputPorts = getNode().getInputPorts();
    switch(state) {
        case EXECUTING:
            for (DataPort dataPort : inputPorts) {
                NodeController.getGUI(((DataPort) dataPort.getFromPort())).removeToken(workflowName);
                NodeController.getGUI(dataPort).addToken(workflowName);
            }
            break;
        case FINISHED:
            for (DataPort dataPort : inputPorts) {
                NodeController.getGUI(dataPort).removeToken(workflowName);
            }
            List<DataPort> outputPorts = getNode().getOutputPorts();
            for (DataPort dataPort : outputPorts) {
                NodeController.getGUI(dataPort).addToken(workflowName);
            }
            break;
        case FAILED:
            break;
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort)

Example 53 with DataPort

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

the class DifferedInputHandler method handleDifferredInputsofDependentNodes.

public static void handleDifferredInputsofDependentNodes(Node node, final XBayaGUI xbayaGUI) {
    List<DataPort> inputPorts = node.getInputPorts();
    for (DataPort dataPort : inputPorts) {
        Node fromNode = dataPort.getFromNode();
        if (isDifferedInputNode(fromNode)) {
            final DifferedInputNode differedInputNode = (DifferedInputNode) fromNode;
            if (!differedInputNode.isConfigured()) {
                // not configured differed node this is what we are looking for
                // set the flag and ensure all the rest is finished
                Runnable task = new Runnable() {

                    @Override
                    public void run() {
                        ((DifferedInputNodeGUI) NodeController.getGUI(differedInputNode)).showConfigurationDialog(xbayaGUI);
                    }
                };
                new Thread(task).start();
            }
        }
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) DifferedInputNode(org.apache.airavata.workflow.model.graph.system.DifferedInputNode) Node(org.apache.airavata.workflow.model.graph.Node) DifferedInputNode(org.apache.airavata.workflow.model.graph.system.DifferedInputNode)

Example 54 with DataPort

use of org.apache.airavata.workflow.model.graph.DataPort 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 55 with DataPort

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

the class GraphUtil method getEncodedInputLabels.

/**
 * @param node
 * @return
 */
public static String getEncodedInputLabels(Node node) {
    if (!isAllInputsConnected(node)) {
        throw new WorkflowRuntimeException("Node inputs not connected" + node);
    }
    if (!isAllInputsLabeled(node)) {
        throw new WorkflowRuntimeException("Some or all of the node inputs not labeled" + node);
    }
    List<DataPort> inputPorts = node.getInputPorts();
    String label = "";
    for (DataPort dataPort : inputPorts) {
        label += "#" + dataPort.getEdge(0).getLabel();
    }
    return label;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Aggregations

DataPort (org.apache.airavata.workflow.model.graph.DataPort)100 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)39 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)26 Node (org.apache.airavata.workflow.model.graph.Node)26 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)20 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)16 GraphException (org.apache.airavata.workflow.model.graph.GraphException)15 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)13 DataType (org.apache.airavata.model.application.io.DataType)12 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)12 Port (org.apache.airavata.workflow.model.graph.Port)11 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)10 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)9 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)8 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)8 LinkedList (java.util.LinkedList)7 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)7 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)7 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)6 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)6