Search in sources :

Example 91 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class WorkflowInterpreter method setupNodeDetailsOutput.

private void setupNodeDetailsOutput(Node node) {
    WorkflowNodeDetails nodeDetails = nodeInstanceList.get(node);
    List<DataPort> outputPorts = node.getOutputPorts();
    Map<String, String> outputData = nodeOutputData.get(node);
    for (DataPort dataPort : outputPorts) {
        String portInputValue = outputData.get(dataPort.getName());
        OutputDataObjectType elem = new OutputDataObjectType();
        elem.setName(dataPort.getName());
        elem.setValue(portInputValue);
        nodeDetails.addToNodeOutputs(elem);
    }
    try {
        getExperimentCatalog().update(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, nodeDetails, nodeDetails.getNodeInstanceId());
    } catch (RegistryException e) {
        log.error(e.getMessage(), e);
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 92 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class ApplicationRegister method createAppOutput.

protected OutputDataObjectType createAppOutput(String inputName, String value, DataType type, boolean isRequired, boolean requiredToCMD, String argument) {
    OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
    if (inputName != null)
        outputDataObjectType.setName(inputName);
    if (value != null)
        outputDataObjectType.setValue(value);
    if (type != null)
        outputDataObjectType.setType(type);
    outputDataObjectType.setIsRequired(isRequired);
    outputDataObjectType.setRequiredToAddedToCommandLine(requiredToCMD);
    outputDataObjectType.setApplicationArgument(argument);
    return outputDataObjectType;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

Example 93 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class ExperimentExecution method processMessage.

private void processMessage(MessageContext message) {
    if (message.getType().equals(MessageType.EXPERIMENT)) {
        try {
            ExperimentStatusChangeEvent event = new ExperimentStatusChangeEvent();
            TBase messageEvent = message.getEvent();
            byte[] bytes = ThriftUtils.serializeThriftObject(messageEvent);
            ThriftUtils.createThriftFromBytes(bytes, event);
            ExperimentState expState = event.getState();
            String expId = event.getExperimentId();
            String gatewayId = event.getGatewayId();
            if (expState.equals(ExperimentState.COMPLETED)) {
                resultWriter.println("Results for experiment : " + expId + " of gateway Id : " + gatewayId);
                resultWriter.println("=====================================================================");
                resultWriter.println("Status : " + ExperimentState.COMPLETED.toString());
                // check file transfers
                List<OutputDataObjectType> experimentOutputs = airavata.getExperimentOutputs(authzToken, expId);
                int i = 1;
                for (OutputDataObjectType output : experimentOutputs) {
                    System.out.println("################ Experiment : " + expId + " COMPLETES ###################");
                    System.out.println("Output " + i + " : " + output.getValue());
                    resultWriter.println("Output " + i + " : " + output.getValue());
                    i++;
                }
                resultWriter.println("End of Results for Experiment : " + expId);
                resultWriter.println("=====================================================================");
            } else if (expState.equals(ExperimentState.FAILED)) {
                resultWriter.println("Results for experiment : " + expId + " of gateway Id : " + gatewayId);
                resultWriter.println("=====================================================================");
                int j = 1;
                resultWriter.println("Status : " + ExperimentState.FAILED.toString());
                System.out.println("################ Experiment : " + expId + " FAILED ###################");
                ExperimentModel experiment = airavata.getExperiment(authzToken, expId);
                List<ErrorModel> errors = experiment.getErrors();
                if (errors != null && !errors.isEmpty()) {
                    for (ErrorModel errorDetails : errors) {
                        System.out.println(errorDetails.getActualErrorMessage());
                        resultWriter.println("Actual Error : " + j + " : " + errorDetails.getActualErrorMessage());
                        resultWriter.println("User Friendly Message : " + j + " : " + errorDetails.getUserFriendlyMessage());
                    }
                }
                resultWriter.println("End of Results for Experiment : " + expId);
                resultWriter.println("=====================================================================");
            }
        } catch (TException e) {
            logger.error(e.getMessage(), e);
        }
    } else if (message.getType().equals(MessageType.JOB)) {
        try {
            JobStatusChangeEvent event = new JobStatusChangeEvent();
            TBase messageEvent = message.getEvent();
            byte[] bytes = ThriftUtils.serializeThriftObject(messageEvent);
            ThriftUtils.createThriftFromBytes(bytes, event);
        } catch (TException e) {
            logger.error(e.getMessage(), e);
        }
    }
    resultWriter.flush();
}
Also used : TException(org.apache.thrift.TException) JobStatusChangeEvent(org.apache.airavata.model.messaging.event.JobStatusChangeEvent) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) ExperimentState(org.apache.airavata.model.status.ExperimentState) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) ExperimentStatusChangeEvent(org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent) ErrorModel(org.apache.airavata.model.commons.ErrorModel) TBase(org.apache.thrift.TBase)

Aggregations

OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)93 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)60 TException (org.apache.thrift.TException)51 AuthzToken (org.apache.airavata.model.security.AuthzToken)44 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)34 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)33 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)33 ArrayList (java.util.ArrayList)18 Project (org.apache.airavata.model.workspace.Project)16 RegistryException (org.apache.airavata.registry.cpi.RegistryException)14 GFacException (org.apache.airavata.gfac.core.GFacException)7 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 URISyntaxException (java.net.URISyntaxException)6 AiravataException (org.apache.airavata.common.exception.AiravataException)5 HashMap (java.util.HashMap)4 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)4 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)4 JobStatus (org.apache.airavata.model.status.JobStatus)4