Search in sources :

Example 6 with ProcessState

use of org.apache.airavata.model.status.ProcessState in project airavata by apache.

the class WorkflowInterpreter method taskOutputChanged.

@Subscribe
public void taskOutputChanged(TaskOutputChangeEvent taskOutputEvent) {
    String taskId = taskOutputEvent.getTaskIdentity().getTaskId();
    if (isTaskAwaiting(taskId)) {
        ProcessState state = ProcessState.COMPLETED;
        Node node = getAwaitingNodeForTask(taskId);
        List<OutputDataObjectType> applicationOutputs = taskOutputEvent.getOutput();
        Map<String, String> outputData = new HashMap<String, String>();
        for (OutputDataObjectType outputObj : applicationOutputs) {
            List<DataPort> outputPorts = node.getOutputPorts();
            for (DataPort dataPort : outputPorts) {
                if (dataPort.getName().equals(outputObj.getName())) {
                    outputData.put(outputObj.getName(), outputObj.getValue());
                }
            }
        }
        nodeOutputData.put(node, outputData);
        setupNodeDetailsOutput(node);
        node.setState(NodeExecutionState.FINISHED);
        try {
            publishNodeStatusChange(WorkflowNodeState.COMPLETED, node.getID(), experiment.getExperimentID());
            updateWorkflowNodeStatus(nodeInstanceList.get(node), state);
        } catch (RegistryException e) {
            log.error(e.getMessage(), e);
        } catch (AiravataException e) {
            log.error(e.getMessage(), e);
        }
    }
}
Also used : ProcessState(org.apache.airavata.model.status.ProcessState) DataPort(org.apache.airavata.workflow.model.graph.DataPort) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) DynamicNode(org.apache.airavata.workflow.model.graph.dynamic.DynamicNode) Node(org.apache.airavata.workflow.model.graph.Node) SubWorkflowNode(org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode) WSNode(org.apache.airavata.workflow.model.graph.ws.WSNode) RegistryException(org.apache.airavata.registry.cpi.RegistryException) AiravataException(org.apache.airavata.common.exception.AiravataException) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

ProcessState (org.apache.airavata.model.status.ProcessState)6 GFacException (org.apache.airavata.gfac.core.GFacException)3 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)3 ErrorModel (org.apache.airavata.model.commons.ErrorModel)3 TaskStatus (org.apache.airavata.model.status.TaskStatus)3 DataStagingTaskModel (org.apache.airavata.model.task.DataStagingTaskModel)3 RegistryException (org.apache.airavata.registry.cpi.RegistryException)3 TException (org.apache.thrift.TException)3 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 AiravataException (org.apache.airavata.common.exception.AiravataException)2 Subscribe (com.google.common.eventbus.Subscribe)1 JSchException (com.jcraft.jsch.JSchException)1 Session (com.jcraft.jsch.Session)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 Timer (java.util.Timer)1