Search in sources :

Example 1 with WorkFlowInterpreterException

use of org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException in project airavata by apache.

the class InterpreterUtil method getNumberOfInputsForForEachNode.

public static Integer[] getNumberOfInputsForForEachNode(final ForEachNode forEachNode, Map<Node, Invoker> invokerMap) throws WorkflowException {
    List<DataPort> inputPorts = forEachNode.getInputPorts();
    Integer[] inputNumbers = new Integer[inputPorts.size()];
    for (DataPort forEachInputPort : inputPorts) {
        // if input node for for-each is WSNode
        Node forEachInputNode = forEachInputPort.getFromNode();
        int index = 0;
        Object returnValForProvenance = null;
        if (forEachInputNode instanceof InputNode) {
            returnValForProvenance = InterpreterUtil.findInputFromPort(forEachInputPort, invokerMap);
            if (null == returnValForProvenance) {
                throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
            }
            String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
            inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
        }
    }
    return inputNumbers;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) 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) WorkFlowInterpreterException(org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException)

Example 2 with WorkFlowInterpreterException

use of org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException in project airavata by apache.

the class XBayaUtil method getInputsForForEachNode.

public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
    Node forEachInputNode = forEachNode.getInputPort(0).getFromNode();
    // if input node for for-each is WSNode
    Object returnValForProvenance = null;
    if (forEachInputNode instanceof InputNode) {
        for (DataPort dataPort : forEachNode.getInputPorts()) {
            returnValForProvenance = XBayaUtil.findInputFromPort(dataPort, invokerMap);
            if (null == returnValForProvenance) {
                throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
            }
            String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
            listOfValues.addAll(Arrays.asList(vals));
        }
    }
    return returnValForProvenance;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) 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) WorkFlowInterpreterException(org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException)

Example 3 with WorkFlowInterpreterException

use of org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException in project airavata by apache.

the class InterpreterUtil method getInputsForForEachNode.

/**
 * This method returns the input values for given foreach node
 *
 * @param forEachNode
 * @param listOfValues
 * @param invokerMap
 * @return
 * @throws WorkflowException
 */
public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
    List<DataPort> inputPorts = forEachNode.getInputPorts();
    Object returnValForProvenance = null;
    for (DataPort inputPort : inputPorts) {
        Node inputNode = inputPort.getFromNode();
        // if input node for for-each is WSNode
        if (inputNode instanceof InputNode) {
            // for (DataPort dataPort : forEachNode.getInputPorts()) {
            returnValForProvenance = InterpreterUtil.findInputFromPort(inputPort, invokerMap);
            if (null == returnValForProvenance) {
                throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
            }
            String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
            listOfValues.addAll(Arrays.asList(vals));
        // }
        }
    }
    return returnValForProvenance;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) 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) WorkFlowInterpreterException(org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException)

Aggregations

WorkFlowInterpreterException (org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException)3 DataPort (org.apache.airavata.workflow.model.graph.DataPort)3 Node (org.apache.airavata.workflow.model.graph.Node)3 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)3 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)3 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)3