Search in sources :

Example 31 with ExperimentModel

use of org.apache.airavata.model.experiment.ExperimentModel in project airavata by apache.

the class CreateLaunchExperimentUS3 method createExperimentForStampede.

public static String createExperimentForStampede(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", "US3EchoExperimentStatus", "US3EchoStampede", "US3EchoStampede", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 1, 1, 1, "development", 0, 0);
        scheduling.setResourceHostId("gsissh-stampede");
        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)

Example 32 with ExperimentModel

use of org.apache.airavata.model.experiment.ExperimentModel in project airavata by apache.

the class CreateLaunchExperimentUS3 method createUS3ExperimentForAlamo.

public static String createUS3ExperimentForAlamo(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/airavata/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(project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "ultrascan_41574ef5-b054-4d03-ab20-2cfe768d5096", "ultrascan", "US3ExperimentStampede", "US3AppStampede", "ultrascan_e76ab5cf-79f6-44df-a244-10a734183fec", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("alamo.uthscsa.edu_7b6cf99a-af2e-4e8b-9eff-998a5ef60fe5", 4, 2, 0, "default", 30, 0);
        scheduling.setResourceHostId("alamo.uthscsa.edu_7b6cf99a-af2e-4e8b-9eff-998a5ef60fe5");
        UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        /*            AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
            dataHandling.setOutputDataDir("/home/airavata/output/");
            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) 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 33 with ExperimentModel

use of org.apache.airavata.model.experiment.ExperimentModel in project airavata by apache.

the class SampleEchoExperiment method createEchoExperiment.

private void createEchoExperiment() throws TException {
    Project project = new Project();
    project.setName("default-project");
    project.setOwner(userId);
    String projectId = airavataClient.createProject(new AuthzToken(""), gatewayId, project);
    ExperimentModel experimentModel = new ExperimentModel();
    experimentModel.setExperimentName("dummy-echo-experiment");
    experimentModel.setProjectId(projectId);
    experimentModel.setUserName(userId);
    experimentModel.setGatewayId(gatewayId);
    experimentModel.setExecutionId(echoInterfaceId);
    UserConfigurationDataModel userConfigurationDataModel = new UserConfigurationDataModel();
    ComputationalResourceSchedulingModel computationalResourceSchedulingModel = new ComputationalResourceSchedulingModel();
    computationalResourceSchedulingModel.setNodeCount(1);
    computationalResourceSchedulingModel.setTotalCPUCount(1);
    computationalResourceSchedulingModel.setTotalPhysicalMemory(512);
    computationalResourceSchedulingModel.setResourceHostId(localhostId);
    userConfigurationDataModel.setComputationalResourceScheduling(computationalResourceSchedulingModel);
    experimentModel.setUserConfigurationData(userConfigurationDataModel);
    List<InputDataObjectType> experimentInputs = new ArrayList<>();
    experimentInputs.add(RegisterSampleApplicationsUtils.createAppInput("Input_to_Echo", "Hello World", DataType.STRING, null, 1, true, true, false, "A test string to Echo", null));
    experimentModel.setExperimentInputs(experimentInputs);
    experimentModel.setExperimentOutputs(airavataClient.getApplicationOutputs(new AuthzToken(""), echoInterfaceId));
    echoExperimentId = airavataClient.createExperiment(new AuthzToken(""), gatewayId, experimentModel);
}
Also used : Project(org.apache.airavata.model.workspace.Project) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) AuthzToken(org.apache.airavata.model.security.AuthzToken) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) ArrayList(java.util.ArrayList) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 34 with ExperimentModel

use of org.apache.airavata.model.experiment.ExperimentModel in project airavata by apache.

the class CreateLaunchBES method createEchoExperimentForFSD.

public static String createEchoExperimentForFSD(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), echoAppId);
        for (InputDataObjectType inputDataObjectType : exInputs) {
            if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo")) {
                inputDataObjectType.setValue("Hello World");
            } else if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo2")) {
                inputDataObjectType.setValue("http://www.textfiles.com/100/ad.txt");
            } else if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo3")) {
                inputDataObjectType.setValue("file:///tmp/test.txt");
            }
        }
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "echoExperiment", "SimpleEcho2", echoAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), echoAppId);
        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, 1, 1, 1, "normal", 30, 1048576);
                    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
                    userConfigurationData.setAiravataAutoSchedule(false);
                    userConfigurationData.setOverrideManualScheduledParams(false);
                    userConfigurationData.setComputationalResourceScheduling(scheduling);
                    userConfigurationData.setGenerateCert(false);
                    userConfigurationData.setUserDN("");
                    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 35 with ExperimentModel

use of org.apache.airavata.model.experiment.ExperimentModel in project airavata by apache.

the class CreateLaunchBES method createAndLaunchExp.

public static void createAndLaunchExp() throws TException {
    List<String> experimentIds = new ArrayList<String>();
    try {
        for (int i = 0; i < 1; i++) {
            // final String expId = createEchoExperimentForFSD(airavataClient);
            final String expId = createMPIExperimentForFSD(airavataClient);
            experimentIds.add(expId);
            System.out.println("Experiment ID : " + expId);
            // updateExperiment(airavata, expId);
            launchExperiment(airavataClient, expId);
        }
        Thread.sleep(10000);
        for (String exId : experimentIds) {
            ExperimentModel experiment = airavataClient.getExperiment(new AuthzToken(""), exId);
            System.out.println(experiment.getExperimentId() + " " + experiment.getExperimentStatus().get(0).getState().name());
        }
    } catch (Exception e) {
        logger.error("Error while connecting with server", e.getMessage());
        e.printStackTrace();
    }
}
Also used : ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) TException(org.apache.thrift.TException)

Aggregations

ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)49 TException (org.apache.thrift.TException)35 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)34 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)34 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)33 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)33 AuthzToken (org.apache.airavata.model.security.AuthzToken)33 Project (org.apache.airavata.model.workspace.Project)17 ArrayList (java.util.ArrayList)15 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 ErrorModel (org.apache.airavata.model.commons.ErrorModel)5 DocumentCreatorNew (org.apache.airavata.integration.tools.DocumentCreatorNew)3 BeforeTest (org.testng.annotations.BeforeTest)3 Test (org.testng.annotations.Test)3 Map (java.util.Map)2 Set (java.util.Set)2 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)2 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)2