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;
}
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;
}
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();
}
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)");
}
Aggregations