use of org.apache.airavata.workflow.core.dag.nodes.ApplicationNode in project airavata by apache.
the class WorkflowInterpreter method handleProcessStatusChangeEvent.
/* synchronized void handleTaskOutputChangeEvent(ProcessStatusChangeEvent taskOutputChangeEvent) {
String taskId = taskOutputChangeEvent.getTaskIdentity().getTaskId();
log.debug("Task Output changed event received for workflow node : " +
taskOutputChangeEvent.getTaskIdentity().getWorkflowNodeId() + ", task : " + taskId);
WorkflowNode workflowNode = processingQueue.get(taskId);
Set<WorkflowNode> tempWfNodeSet = new HashSet<>();
if (workflowNode != null) {
if (workflowNode instanceof ApplicationNode) {
ApplicationNode applicationNode = (ApplicationNode) workflowNode;
// Workflow node can have one to many output ports and each output port can have one to many links
for (OutPort outPort : applicationNode.getOutputPorts()) {
for (OutputDataObjectType outputDataObjectType : taskOutputChangeEvent.getOutput()) {
if (outPort.getOutputObject().getName().equals(outputDataObjectType.getName())) {
outPort.getOutputObject().setValue(outputDataObjectType.getValue());
break;
}
}
for (Edge edge : outPort.getEdges()) {
edge.getToPort().getInputObject().setValue(outPort.getOutputObject().getValue());
if (edge.getToPort().getNode().isReady()) {
addToReadyQueue(edge.getToPort().getNode());
}
}
}
addToCompleteQueue(applicationNode);
log.debug("removed task from processing queue : " + taskId);
}
try {
processReadyList();
} catch (Exception e) {
log.error("Error while processing ready workflow nodes", e);
continueWorkflow = false;
}
}
}*/
void handleProcessStatusChangeEvent(ProcessStatusChangeEvent processStatusChangeEvent) {
ProcessState processState = processStatusChangeEvent.getState();
ProcessIdentifier processIdentity = processStatusChangeEvent.getProcessIdentity();
String processId = processIdentity.getProcessId();
ApplicationNode applicationNode = (ApplicationNode) processingQueue.get(processId);
if (applicationNode != null) {
ComponentState state = applicationNode.getState();
switch(processState) {
case CREATED:
case VALIDATED:
case STARTED:
break;
case CONFIGURING_WORKSPACE:
case PRE_PROCESSING:
case INPUT_DATA_STAGING:
case EXECUTING:
case OUTPUT_DATA_STAGING:
case POST_PROCESSING:
state = ComponentState.RUNNING;
break;
case COMPLETED:
state = ComponentState.COMPLETED;
// FIXME: read output form registry and set it to node outputport then continue to next application.
break;
case FAILED:
state = ComponentState.FAILED;
// FIXME: fail workflow.
break;
case CANCELED:
case CANCELLING:
state = ComponentState.CANCELED;
// FIXME: cancel workflow.
break;
default:
break;
}
if (state != applicationNode.getState()) {
try {
updateWorkflowNodeStatus(applicationNode, new ComponentStatus(state));
} catch (RegistryException e) {
log.error("Error! Couldn't update new application state to registry. nodeInstanceId : {} " + applicationNode.getId() + " status to: " + applicationNode.getState().toString(), e);
}
}
}
}
use of org.apache.airavata.workflow.core.dag.nodes.ApplicationNode in project airavata by apache.
the class JsonWorkflowParser method getNodeInPortsMap.
private Map<String, InPort> getNodeInPortsMap(List<ApplicationNode> applicationNodes) {
Map<String, InPort> nodeInPortsMap = new HashMap<>();
if (applicationNodes != null) {
for (ApplicationNode applicationNode : applicationNodes) {
for (InPort inPort : applicationNode.getInputPorts()) {
inPort.setNode(applicationNode);
nodeInPortsMap.put(applicationNode.getId() + "," + inPort.getId(), inPort);
}
}
}
return nodeInPortsMap;
}
Aggregations