Search in sources :

Example 51 with InputDataObjectType

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

the class ThriftDataModelConversion method getExpInputs.

public static List<InputDataObjectType> getExpInputs(List<ExperimentInputResource> exInputList) {
    List<InputDataObjectType> expInputs = new ArrayList<InputDataObjectType>();
    if (exInputList != null && !exInputList.isEmpty()) {
        for (ExperimentInputResource inputResource : exInputList) {
            InputDataObjectType exInput = getInput(inputResource);
            expInputs.add(exInput);
        }
    }
    return expInputs;
}
Also used : InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList)

Example 52 with InputDataObjectType

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

the class WorkflowCatalogThriftConversion method getWorkflowInput.

public static InputDataObjectType getWorkflowInput(WorkflowInputResource resource) {
    InputDataObjectType input = new InputDataObjectType();
    input.setName(resource.getInputKey());
    input.setApplicationArgument(resource.getAppArgument());
    input.setInputOrder(resource.getInputOrder());
    input.setType(DataType.valueOf(resource.getDataType()));
    input.setMetaData(resource.getMetadata());
    input.setUserFriendlyDescription(resource.getUserFriendlyDesc());
    input.setIsRequired(resource.getRequired());
    input.setRequiredToAddedToCommandLine(resource.getRequiredToCMD());
    input.setDataStaged(resource.isDataStaged());
    return input;
}
Also used : InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType)

Example 53 with InputDataObjectType

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

the class AppInterfaceTest method testAppInterface.

@Test
public void testAppInterface() {
    try {
        ApplicationInterface appInterface = appcatalog.getApplicationInterface();
        ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
        String wrfModuleId = addAppModule("WRF");
        String amberModuleId = addAppModule("AMBER");
        List<String> modules = new ArrayList<String>();
        modules.add(wrfModuleId);
        modules.add(amberModuleId);
        InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING);
        InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER);
        List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
        inputs.add(appInput1);
        inputs.add(appInput2);
        OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING);
        OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING);
        List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
        outputs.add(output1);
        outputs.add(output2);
        description.setApplicationName("testApplication");
        description.setApplicationDescription("my testApplication");
        description.setApplicationModules(modules);
        description.setApplicationInputs(inputs);
        description.setApplicationOutputs(outputs);
        String appID = appInterface.addApplicationInterface(description, ServerSettings.getDefaultUserGateway());
        System.out.println("********** application id ************* : " + appID);
        ApplicationInterfaceDescription ainterface = null;
        if (appInterface.isApplicationInterfaceExists(appID)) {
            ainterface = appInterface.getApplicationInterface(appID);
            OutputDataObjectType output3 = createAppOutput("output3", "", DataType.STRING);
            OutputDataObjectType output4 = createAppOutput("output4", "", DataType.STRING);
            outputs.add(output3);
            outputs.add(output4);
            ainterface.setApplicationOutputs(outputs);
            appInterface.updateApplicationInterface(appID, ainterface);
            ApplicationInterfaceDescription updateApp = appInterface.getApplicationInterface(appID);
            List<OutputDataObjectType> appOutputs = updateApp.getApplicationOutputs();
            System.out.println("********** application name ************* : " + updateApp.getApplicationName());
            System.out.println("********** application description ************* : " + updateApp.getApplicationDescription());
            System.out.println("********** output size ************* : " + appOutputs.size());
        }
        ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId);
        System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName());
        ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId);
        System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName());
        List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID);
        System.out.println("********** App Input size ************* : " + applicationInputs.size());
        List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID);
        System.out.println("********** App output size ************* : " + applicationOutputs.size());
        description.setApplicationName("testApplication2");
        appInterface.updateApplicationInterface(appID, description);
        if (appInterface.isApplicationInterfaceExists(appID)) {
            ainterface = appInterface.getApplicationInterface(appID);
            System.out.println("********** updated application name ************* : " + ainterface.getApplicationName());
        }
        wrfModule.setAppModuleVersion("1.0.1");
        appInterface.updateApplicationModule(wrfModuleId, wrfModule);
        wrfModule = appInterface.getApplicationModule(wrfModuleId);
        System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion());
        Map<String, String> filters = new HashMap<String, String>();
        filters.put(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2");
        List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
        System.out.println("********** Size og app interfaces ************* : " + apps.size());
        List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces(ServerSettings.getDefaultUserGateway());
        System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
        List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
        System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size());
        assertTrue("App interface saved successfully", ainterface != null);
    } catch (AppCatalogException e) {
        e.printStackTrace();
    } catch (ApplicationSettingsException e) {
        e.printStackTrace();
    }
}
Also used : ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) HashMap(java.util.HashMap) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) ApplicationInterface(org.apache.airavata.registry.cpi.ApplicationInterface) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) Test(org.junit.Test)

Example 54 with InputDataObjectType

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

the class CreateLaunchExperiment method createExperimentForStampedeAmber.

public static String createExperimentForStampedeAmber(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), amberAppId);
        // }
        for (InputDataObjectType inputDataObjectType : exInputs) {
            if (inputDataObjectType.getName().equalsIgnoreCase("Heat_Restart_File")) {
                inputDataObjectType.setValue("file://ogce@stampede.xsede.org:/scratch/01437/ogce/gta-work-dirs/PROCESS_e0610a6c-5778-4a69-a004-f440e29194af/02_Heat.rst");
            } else if (inputDataObjectType.getName().equalsIgnoreCase("Production_Control_File")) {
                inputDataObjectType.setValue("file://ogce@stampede.xsede.org:/scratch/01437/ogce/gta-work-dirs/PROCESS_e0610a6c-5778-4a69-a004-f440e29194af/03_Prod.in");
            } else if (inputDataObjectType.getName().equalsIgnoreCase("Parameter_Topology_File")) {
                inputDataObjectType.setValue("file://ogce@stampede.xsede.org:/scratch/01437/ogce/gta-work-dirs/PROCESS_e0610a6c-5778-4a69-a004-f440e29194af/prmtop");
            }
        }
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), amberAppId);
        Project project = ProjectModelUtil.createProject("default", "admin", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", amberAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), amberAppId);
        if (computeResources != null && computeResources.size() != 0) {
            for (String id : computeResources.keySet()) {
                String resourceName = computeResources.get(id);
                if (resourceName.equals(stampedeHostName)) {
                    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 1);
                    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
                    userConfigurationData.setAiravataAutoSchedule(false);
                    userConfigurationData.setOverrideManualScheduledParams(false);
                    userConfigurationData.setComputationalResourceScheduling(scheduling);
                    simpleExperiment.setUserConfigurationData(userConfigurationData);
                    return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
                }
            }
        }
    } catch (AiravataSystemException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new AiravataSystemException(e);
    } catch (InvalidRequestException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new InvalidRequestException(e);
    } catch (AiravataClientException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new AiravataClientException(e);
    } catch (TException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new TException(e);
    }
    return null;
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) Project(org.apache.airavata.model.workspace.Project) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 55 with InputDataObjectType

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

the class CreateLaunchExperiment method createMPIExperimentForFSD.

public static String createMPIExperimentForFSD(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), mpiAppId);
        for (InputDataObjectType inputDataObjectType : exInputs) {
            if (inputDataObjectType.getName().equalsIgnoreCase("Sample_Input")) {
                inputDataObjectType.setValue("");
            }
        }
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), mpiAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "mpiExperiment", "HelloMPI", mpiAppId, null);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), mpiAppId);
        if (computeResources != null && computeResources.size() != 0) {
            for (String id : computeResources.keySet()) {
                String resourceName = computeResources.get(id);
                if (resourceName.equals(unicoreHostName)) {
                    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 2, 1, 2, "normal", 30, 1048576);
                    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
                    userConfigurationData.setAiravataAutoSchedule(false);
                    userConfigurationData.setOverrideManualScheduledParams(false);
                    userConfigurationData.setComputationalResourceScheduling(scheduling);
                    userConfigurationData.setGenerateCert(false);
                    userConfigurationData.setUserDN("");
                    simpleExperiment.setUserConfigurationData(userConfigurationData);
                    return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
                }
            }
        }
    } catch (AiravataSystemException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new AiravataSystemException(e);
    } catch (InvalidRequestException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new InvalidRequestException(e);
    } catch (AiravataClientException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new AiravataClientException(e);
    } catch (TException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new TException(e);
    }
    return null;
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Aggregations

InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)86 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)60 TException (org.apache.thrift.TException)49 AuthzToken (org.apache.airavata.model.security.AuthzToken)46 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)35 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)35 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)34 ArrayList (java.util.ArrayList)20 Project (org.apache.airavata.model.workspace.Project)17 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 RegistryException (org.apache.airavata.registry.cpi.RegistryException)6 HashMap (java.util.HashMap)3 DocumentCreatorNew (org.apache.airavata.integration.tools.DocumentCreatorNew)3 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)3 BeforeTest (org.testng.annotations.BeforeTest)3 Test (org.testng.annotations.Test)3 JSchException (com.jcraft.jsch.JSchException)2 Session (com.jcraft.jsch.Session)2