Search in sources :

Example 36 with OutputDataObjectType

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

the class AppInterfaceUtil method createApplicationOutput.

public static OutputDataObjectType createApplicationOutput(String name, String value, DataType type) {
    OutputDataObjectType appOutput = new OutputDataObjectType();
    appOutput.setName(name);
    appOutput.setValue(value);
    appOutput.setType(type);
    return appOutput;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

Example 37 with OutputDataObjectType

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

the class SimpleOrchestratorImpl method createAndSaveOutputDataStagingTasks.

public List<String> createAndSaveOutputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException, AiravataException {
    List<String> dataStagingTaskIds = new ArrayList<>();
    List<OutputDataObjectType> processOutputs = processModel.getProcessOutputs();
    String appName = OrchestratorUtils.getApplicationInterfaceName(orchestratorContext, processModel);
    if (processOutputs != null) {
        for (OutputDataObjectType processOutput : processOutputs) {
            DataType type = processOutput.getType();
            switch(type) {
                case STDOUT:
                    if (null == processOutput.getValue() || processOutput.getValue().trim().isEmpty()) {
                        processOutput.setValue(appName + ".stdout");
                    }
                    createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
                    break;
                case STDERR:
                    if (null == processOutput.getValue() || processOutput.getValue().trim().isEmpty()) {
                        processOutput.setValue(appName + ".stderr");
                    }
                    createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
                    break;
                case URI:
                    createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
                    break;
                default:
                    // nothing to do
                    break;
            }
        }
    }
    try {
        if (isArchive(processModel, gatewayId)) {
            createArchiveDataStatgingTask(processModel, gatewayId, dataStagingTaskIds);
        }
    } catch (AppCatalogException e) {
        throw new RegistryException("Error! Application interface retrieval failed");
    }
    return dataStagingTaskIds;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) DataType(org.apache.airavata.model.application.io.DataType)

Example 38 with OutputDataObjectType

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

the class OrchestratorClientSample method storeExperimentDetail.

/*

    public static void main(String[] args) {
        try {
            AiravataUtils.setExecutionAsClient();
            sysUser = ClientSettings.getSetting(DEFAULT_USER);
            sysUserPwd = ClientSettings.getSetting(DEFAULT_USER_PASSWORD);
            gateway = ClientSettings.getSetting(DEFAULT_GATEWAY);
            orchestratorClient = OrchestratorClientFactory.createOrchestratorClient("localhost", 8940);
            registry = RegistryFactory.getRegistry(gateway, sysUser, sysUserPwd);
            documentCreator = new DocumentCreator(getAiravataAPI());
            documentCreator.createLocalHostDocs();
            documentCreator.createGramDocs();
            documentCreator.createPBSDocsForOGCE();
            storeExperimentDetail();
        } catch (ApplicationSettingsException e) {
            e.printStackTrace();
        } catch (RegistryException e) {
            e.printStackTrace();
        }

    }

    private static AiravataAPI getAiravataAPI() {
        AiravataAPI airavataAPI = null;
            try {
                airavataAPI = AiravataAPIFactory.getAPI(gateway, sysUser);
            } catch (AiravataAPIInvocationException e) {
                e.printStackTrace();
            }
        return airavataAPI;
    }
*/
public static void storeExperimentDetail() {
    for (int i = 0; i < NUM_CONCURRENT_REQUESTS; i++) {
        Thread thread = new Thread() {

            public void run() {
                List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
                InputDataObjectType input = new InputDataObjectType();
                input.setName("echo_input");
                input.setType(DataType.STRING);
                input.setValue("echo_output=Hello World");
                exInputs.add(input);
                List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
                OutputDataObjectType output = new OutputDataObjectType();
                output.setName("echo_output");
                output.setType(DataType.STRING);
                output.setValue("");
                exOut.add(output);
                ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs);
                simpleExperiment.setExperimentOutputs(exOut);
                ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0);
                scheduling.setResourceHostId("gsissh-trestles");
                UserConfigurationDataModel userConfigurationDataModel = new UserConfigurationDataModel();
                userConfigurationDataModel.setComputationalResourceScheduling(scheduling);
                simpleExperiment.setUserConfigurationData(userConfigurationDataModel);
                String expId = null;
                try {
                // expId = (String) registry.add(ParentDataType.EXPERIMENT, simpleExperiment);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                try {
                    orchestratorClient.launchExperiment(expId, "airavataToken");
                } catch (TException e) {
                    e.printStackTrace();
                }
            }
        };
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) TException(org.apache.thrift.TException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 39 with OutputDataObjectType

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

the class OutputNodeImpl method convert.

private OutputDataObjectType convert(InputDataObjectType inputObject) {
    if (inputObject != null) {
        OutputDataObjectType output = new OutputDataObjectType(getName());
        output.setValue(inputObject.getValue());
        output.setType(inputObject.getType());
        return output;
    }
    return null;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

Example 40 with OutputDataObjectType

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

the class DataTransferrer method downloadStdOuts.

public void downloadStdOuts() throws GFacException {
    String stdoutFileName = new File(stdoutLocation).getName();
    String stderrFileName = new File(stderrLocation).getName();
    FileDownloader f1 = null;
    log.info("Downloading stdout and stderr..");
    log.info(stdoutFileName + " -> " + stdoutLocation);
    f1 = new FileDownloader(stdoutFileName, stdoutLocation, Mode.overwrite);
    try {
        f1.perform(storageClient);
    // String stdoutput = readFile(stdoutLocation);
    } catch (Exception e) {
        log.error("Error while downloading " + stdoutFileName + " to location " + stdoutLocation, e);
    }
    log.info(stderrFileName + " -> " + stderrLocation);
    f1.setFrom(stderrFileName);
    f1.setTo(stderrLocation);
    try {
        f1.perform(storageClient);
    // String stderror = readFile(stderrLocation);
    } catch (Exception e) {
        log.error("Error while downloading " + stderrFileName + " to location " + stderrLocation);
    }
    String scriptExitCodeFName = "UNICORE_SCRIPT_EXIT_CODE";
    String scriptCodeLocation = gatewayDownloadLocation + File.separator + scriptExitCodeFName;
    if (UASDataStagingProcessor.isUnicoreEndpoint(processContext)) {
        f1.setFrom(scriptExitCodeFName);
        f1.setTo(scriptCodeLocation);
        try {
            f1.perform(storageClient);
            OutputDataObjectType output = new OutputDataObjectType();
            output.setName(scriptExitCodeFName);
            output.setValue(scriptCodeLocation);
            output.setType(DataType.URI);
            output.setIsRequired(true);
            processContext.getProcessModel().getProcessOutputs().add(output);
            log.info("UNICORE_SCRIPT_EXIT_CODE -> " + scriptCodeLocation);
            log.info("EXIT CODE: " + readFile(scriptCodeLocation));
        } catch (Exception e) {
            log.error("Error downloading file " + scriptExitCodeFName + " to location " + scriptCodeLocation, e);
        }
    }
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) GFacException(org.apache.airavata.gfac.core.GFacException) URISyntaxException(java.net.URISyntaxException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

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