Search in sources :

Example 51 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType 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 52 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType 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 53 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType 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)

Example 54 with OutputDataObjectType

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

the class CreateLaunchExperimentUS3 method createUS3ExperimentForStampede.

public static String createUS3ExperimentForStampede(Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException {
    try {
        List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
        InputDataObjectType input = new InputDataObjectType();
        input.setName("input");
        input.setType(DataType.URI);
        input.setValue("file:///home/sgg/chathuri/laptop_backup/airavata/ultrascan_input/hpcinput.tar");
        InputDataObjectType input1 = new InputDataObjectType();
        input1.setName("walltime");
        input1.setType(DataType.STRING);
        input1.setValue("-walltime=60");
        InputDataObjectType input2 = new InputDataObjectType();
        input2.setName("mgroupcount");
        input2.setType(DataType.STRING);
        input2.setValue("-mgroupcount=1");
        exInputs.add(input);
        exInputs.add(input1);
        exInputs.add(input2);
        List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
        OutputDataObjectType output = new OutputDataObjectType();
        output.setName("output");
        output.setType(DataType.URI);
        output.setValue("");
        // OutputDataObjectType output1 = new OutputDataObjectType();
        // output1.setName("stdout");
        // output1.setType(DataType.STDOUT);
        // output1.setValue("");
        // OutputDataObjectType output2 = new OutputDataObjectType();
        // output2.setName("stderr");
        // output2.setType(DataType.STDERR);
        // output2.setValue("");
        exOut.add(output);
        // exOut.add(output1);
        // exOut.add(output2);
        Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "ultrascan", "US3ExperimentStampede", "US3AppStampede", "ultrascan_7ce6cd43-622c-44e0-87c5-fb7a6528c799", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org_e59e046f-e0e1-49c4-8475-2fab2e35d044", 32, 2, 0, "normal", 30, 0);
        scheduling.setResourceHostId("stampede.tacc.xsede.org_e59e046f-e0e1-49c4-8475-2fab2e35d044");
        UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        /*            AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
            dataHandling.setOutputDataDir("/home/sgg/chathuri/laptop_backup/airavata");
            userConfigurationData.setAdvanceOutputDataHandling(dataHandling);*/
        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);
    }
}
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) Project(org.apache.airavata.model.workspace.Project) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 55 with OutputDataObjectType

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

the class CreateLaunchExperimentUS3 method createExperimentForTrestles.

// public static void addDescriptors() throws AiravataAPIInvocationException,ApplicationSettingsException  {
// try {
// UltrascanDocumentCreator documentCreator = new UltrascanDocumentCreator(getAiravataAPI());
// documentCreator.createMPIPBSDocsTrestles();
// documentCreator.createEchoPBSDocsforTestles();
// documentCreator.createEchoSlurmDocsofStampede();
// documentCreator.createMPISLURMDocsStampede();
// } catch (AiravataAPIInvocationException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new AiravataAPIInvocationException(e);
// } catch (ApplicationSettingsException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new ApplicationSettingsException(e.getMessage());
// }
// }
// private static AiravataAPI getAiravataAPI() throws AiravataAPIInvocationException, ApplicationSettingsException {
// AiravataAPI airavataAPI;
// try {
// String sysUser = ClientSettings.getSetting(DEFAULT_USER);
// String gateway = ClientSettings.getSetting(DEFAULT_GATEWAY);
// airavataAPI = AiravataAPIFactory.getAPI(gateway, sysUser);
// } catch (AiravataAPIInvocationException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new AiravataAPIInvocationException(e);
// } catch (ApplicationSettingsException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new ApplicationSettingsException(e.getMessage());
// }
// return airavataAPI;
// }
public static String createExperimentForTrestles(Airavata.Client client) throws TException {
    try {
        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);
        Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "admin", "US3EchoExperimentTrestles", "US3EchoTrestles", "US3EchoTrestles", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "shared", 0, 0);
        scheduling.setResourceHostId("gsissh-trestles");
        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);
    }
}
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) Project(org.apache.airavata.model.workspace.Project) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

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