Search in sources :

Example 16 with DataPort

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

the class GraphCanvas method rerunSelectedNode.

private void rerunSelectedNode() {
    if (this.selectedNode != null) {
        ArrayList<Node> exploreNodes = new ArrayList<Node>();
        exploreNodes.add(this.selectedNode);
        while (exploreNodes.size() != 0) {
            Node node = exploreNodes.get(0);
            List<DataPort> outputPorts = node.getOutputPorts();
            for (DataPort dataPort : outputPorts) {
                exploreNodes.addAll(dataPort.getToNodes());
            }
            node.setState(NodeExecutionState.WAITING);
            exploreNodes.remove(0);
        }
        this.repaint();
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) DynamicNode(org.apache.airavata.workflow.model.graph.dynamic.DynamicNode) Node(org.apache.airavata.workflow.model.graph.Node) StreamSourceNode(org.apache.airavata.workflow.model.graph.system.StreamSourceNode) ArrayList(java.util.ArrayList)

Example 17 with DataPort

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

the class GraphCanvas method mouseClicked.

private void mouseClicked(MouseEvent event) {
    /*
         * If there is multi-selected and a click on a node, switch to that node or deselect node if it is already
         * selected
         */
    Point point = event.getPoint();
    GraphPiece clicked = NodeController.getGUI(this.graph).getGraphPieceAt(point);
    if ((clicked instanceof Node) && this.multipleSelectedNodes != null) {
        Node node = (Node) clicked;
        if (!this.crtlPressed) {
            selectNode(node);
        }
        return;
    } else if ((clicked instanceof Port) && event.getClickCount() == 2) {
        // double click to add Input/Output nodes and connect with them when a DataPort is double clicked
        Port port = (Port) clicked;
        Point pos = port.getNode().getPosition();
        Node node = null;
        int xgap = (int) (1.5 * NodeGUI.MINIMUM_WIDTH);
        int ygap = (int) (NodeGUI.MINIMUM_HEIGHT / 2);
        Point nodePos = null;
        switch(port.getKind()) {
            case DATA_IN:
                if (port.getFromNode() == null) {
                    nodePos = new Point(Math.max(0, pos.x - xgap), Math.max(0, pos.y - ygap));
                    node = addNode(new InputComponent(), nodePos);
                    connect(node.getOutputPorts().get(0), port);
                }
                break;
            case DATA_OUT:
                nodePos = new Point(pos.x + NodeGUI.MINIMUM_WIDTH + xgap, pos.y + ygap);
                node = addNode(new OutputComponent(), nodePos);
                connect(port, node.getInputPorts().get(0));
                break;
            default:
        }
    }
    // delegate the event.
    NodeController.getGUI(this.graph).mouseClicked(event, this.engine);
}
Also used : InputComponent(org.apache.airavata.workflow.model.component.system.InputComponent) GraphPiece(org.apache.airavata.workflow.model.graph.GraphPiece) OutputComponent(org.apache.airavata.workflow.model.component.system.OutputComponent) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) DynamicNode(org.apache.airavata.workflow.model.graph.dynamic.DynamicNode) Node(org.apache.airavata.workflow.model.graph.Node) StreamSourceNode(org.apache.airavata.workflow.model.graph.system.StreamSourceNode) DataPort(org.apache.airavata.workflow.model.graph.DataPort) Port(org.apache.airavata.workflow.model.graph.Port) Point(java.awt.Point)

Example 18 with DataPort

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

the class NodeGUI method resetTokens.

/**
 */
public void resetTokens() {
    List<DataPort> inputPorts = getNode().getInputPorts();
    for (DataPort dataPort : inputPorts) {
        NodeController.getGUI(dataPort).reset();
    }
    List<DataPort> outputPorts = getNode().getOutputPorts();
    for (DataPort dataPort : outputPorts) {
        NodeController.getGUI(dataPort).reset();
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort)

Example 19 with DataPort

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

the class LaunchApplicationWindow method execute.

private void execute() throws AiravataClientConnectException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
    List<NodeImpl> nodes = workflow.getGraph().getNodes();
    String gatewayId = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId();
    String appId = null;
    NodeImpl node = null;
    for (int i = 0; i < nodes.size(); i++) {
        node = nodes.get(i);
        String html = node.getComponent().toHTML();
        String nodeType = html.substring(html.indexOf("<h1>") + 4, html.indexOf(":")).trim();
        if (nodeType.equals("Application")) {
            appId = html.substring(html.indexOf("</h2>") + 6, html.indexOf("<br")).trim();
            break;
        }
    }
    String hostId = null;
    String hostName = (String) host.getSelectedItem();
    hostId = hostNames.get(hostName);
    String instanceName = this.instanceNameTextField.getText();
    if (instanceName.trim().equals("")) {
        JOptionPane.showMessageDialog(engine.getGUI().getFrame(), "Experiment name cannot be empty", "Experiment Name", JOptionPane.ERROR_MESSAGE);
        return;
    }
    // previous instance name
    if (!instanceNameTextField.getText().equals("")) {
        this.instanceNameTextField.setText("");
    }
    Project project = new Project();
    project.setName("project1");
    String owner = this.thriftClientData.getUsername();
    if (owner.equals(""))
        owner = "NotKnown";
    project.setOwner(owner);
    project.setProjectID(airavataClient.createProject(gatewayId, project));
    // final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
    final List<DataPort> inputPorts = node.getInputPorts();
    final Experiment experiment = new Experiment();
    experiment.setApplicationId(appId);
    ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
    scheduling.setResourceHostId(hostId);
    if (hostName.trim().equals("trestles.sdsc.xsede.org")) {
        scheduling.setComputationalProjectAccount("sds128");
    } else if (hostName.trim().equals("stampede.tacc.xsede.org")) {
        scheduling.setComputationalProjectAccount("TG-STA110014S");
    }
    scheduling.setNodeCount(1);
    scheduling.setTotalCPUCount(1);
    scheduling.setWallTimeLimit(15);
    scheduling.setQueueName("normal");
    UserConfigurationData userConfigurationData = new UserConfigurationData();
    userConfigurationData.setAiravataAutoSchedule(false);
    userConfigurationData.setOverrideManualScheduledParams(false);
    userConfigurationData.setComputationalResourceScheduling(scheduling);
    experiment.setUserConfigurationData(userConfigurationData);
    experiment.setName(instanceName);
    experiment.setProjectID(project.getProjectID());
    experiment.setUserName(thriftClientData.getUsername());
    for (int i = 0; i < inputPorts.size(); i++) {
        DataPort inputPort = inputPorts.get(i);
        XBayaTextField parameterTextField = this.parameterTextFields.get(i);
        String value = parameterTextField.getText();
        InputDataObjectType elem = new InputDataObjectType();
        elem.setName(inputPort.getName());
        elem.setType(elem.getType());
        elem.setValue(value);
        experiment.addToExperimentInputs(elem);
    }
    final List<DataPort> outputPorts = node.getOutputPorts();
    for (int i = 0; i < outputPorts.size(); i++) {
        DataPort outputPort = outputPorts.get(i);
        OutputDataObjectType elem = new OutputDataObjectType();
        elem.setName(outputPort.getName());
        elem.setType(elem.getType());
        elem.setValue("");
        experiment.addToExperimentOutputs(elem);
    }
    experiment.setExperimentID(airavataClient.createExperiment(gatewayId, experiment));
    airavataClient.launchExperiment(experiment.getExperimentID(), "testToken");
    hide();
    JOptionPane.showMessageDialog(null, "Experiment Launched. You will be alerted on completion.");
    String status = airavataClient.getExperimentStatus(experiment.getExperimentID()).getExperimentState().toString().trim();
    while (!status.equals("COMPLETED") && !status.equals("FAILED")) {
        try {
            Thread.sleep(1000);
            status = airavataClient.getExperimentStatus(experiment.getExperimentID()).getExperimentState().toString().trim();
        } catch (InterruptedException e) {
            logger.error(e.getMessage(), e);
        }
    }
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        logger.error(e.getMessage(), e);
    }
    if (status.equals("COMPLETED")) {
        String output = "";
        ;
        String fullOutput = "";
        while (output.equals("")) {
            output = "";
            fullOutput = "Experiment Completed Successfully. Output(s) are shown below:\n";
            List<OutputDataObjectType> outputs = airavataClient.getExperimentOutputs(experiment.getExperimentID());
            for (int i1 = 0; i1 < outputs.size(); i1++) {
                output = outputs.get(i1).getValue();
                fullOutput += outputs.get(i1).getName() + ": " + output + "\n";
            }
        }
        JOptionPane.showMessageDialog(null, fullOutput);
    } else {
        JOptionPane.showMessageDialog(null, "Experiment Failed");
        return;
    }
    new Thread() {

        @Override
        public void run() {
        }
    }.start();
    hide();
}
Also used : ComputationalResourceScheduling(org.apache.airavata.model.experiment.ComputationalResourceScheduling) UserConfigurationData(org.apache.airavata.model.experiment.UserConfigurationData) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) InputDataObjectType(org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType) DataPort(org.apache.airavata.workflow.model.graph.DataPort) Project(org.apache.airavata.model.workspace.Project) OutputDataObjectType(org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField)

Example 20 with DataPort

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

the class DoWhileNode method removeInputPort.

public void removeInputPort() throws GraphException {
    List<DataPort> inputPorts = getInputPorts();
    // Remove the last one.
    DataPort inputPort = inputPorts.get(inputPorts.size() - 1);
    removeInputPort(inputPort);
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort)

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