Search in sources :

Example 11 with ExperimentModel

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

the class CreateLaunchExperiment method updateExperiment.

public static void updateExperiment(Airavata.Client client, String expId) throws TException {
    try {
        ExperimentModel experiment = client.getExperiment(new AuthzToken(""), expId);
        experiment.setDescription("updatedDescription");
        client.updateExperiment(new AuthzToken(""), expId, experiment);
    } catch (TException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new TException(e);
    }
}
Also used : TException(org.apache.thrift.TException) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 12 with ExperimentModel

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

the class CreateLaunchExperimentUS3 method createUS3ExperimentForTrestles.

public static String createUS3ExperimentForTrestles(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("ultrascan", "ultrascan", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "ultrascan", "US3ExperimentTrestles", "US3AppTrestles", "ultrascan_7ce6cd43-622c-44e0-87c5-fb7a6528c799", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.xsede.org_72b9181b-7156-4975-a386-ed98b4949496", 32, 1, 0, "shared", 30, 0);
        UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
        scheduling.setResourceHostId("trestles.sdsc.xsede.org_72b9181b-7156-4975-a386-ed98b4949496");
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        /*          AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
            dataHandling.setOutputDataDir("/home/sgg/chathuri/laptop_backup/airavata");
            userConfigurationData.setAdvanceOutputDataHandling(dataHandling);*/
        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 13 with ExperimentModel

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

the class CreateLaunchBES 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("NumberOfProcesses")) {
                inputDataObjectType.setValue("32");
            }
            if (inputDataObjectType.getName().equalsIgnoreCase("US3INPUT")) {
                inputDataObjectType.setValue("file://home/m.memon/us3input/smallerdata/hpcinput-uslims3.uthscsa.edu-uslims3_cauma3-01594.tar");
            }
            if (inputDataObjectType.getName().equalsIgnoreCase("US3INPUTARG")) {
                inputDataObjectType.setValue("hpcinput-uslims3.uthscsa.edu-uslims3_cauma3-01594.tar");
            }
        }
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), mpiAppId);
        for (OutputDataObjectType outputDataObjectType : exOut) {
            if (outputDataObjectType.getName().equals("US3OUT")) {
                outputDataObjectType.setValue("output/analysis-results.tar");
            }
        }
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "mpiExperiment", "HelloMPI", mpiAppId, exInputs);
        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, 0, 4, 0, null, 10, 0);
                    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
                    userConfigurationData.setAiravataAutoSchedule(false);
                    userConfigurationData.setOverrideManualScheduledParams(false);
                    userConfigurationData.setComputationalResourceScheduling(scheduling);
                    userConfigurationData.setGenerateCert(true);
                    userConfigurationData.setUserDN("CN=m.memon, O=Ultrascan Gateway, C=DE");
                    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 14 with ExperimentModel

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

the class CreateLaunchBES method getExperiment.

public static void getExperiment(Airavata.Client client, String expId) throws Exception {
    try {
        ExperimentModel experiment = client.getExperiment(new AuthzToken(""), expId);
        List<ErrorModel> errors = experiment.getErrors();
        if (errors != null && !errors.isEmpty()) {
            for (ErrorModel error : errors) {
                System.out.println("ERROR MESSAGE : " + error.getActualErrorMessage());
            }
        }
    } catch (ExperimentNotFoundException e) {
        logger.error("Experiment does not exist", e);
        throw new ExperimentNotFoundException("Experiment does not exist");
    } catch (AiravataSystemException e) {
        logger.error("Error while retrieving experiment", e);
        throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
    } catch (InvalidRequestException e) {
        logger.error("Error while retrieving experiment", e);
        throw new InvalidRequestException("Error while retrieving experiment");
    } catch (AiravataClientException e) {
        logger.error("Error while retrieving experiment", e);
        throw new AiravataClientException(AiravataErrorType.INTERNAL_ERROR);
    }
}
Also used : ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) ErrorModel(org.apache.airavata.model.commons.ErrorModel)

Example 15 with ExperimentModel

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

the class CreateLaunchExperiment method createExperimentTRINITYStampede.

public static String createExperimentTRINITYStampede(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), trinityAppId);
        setTRINITYInputs(exInputs);
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), trinityAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "TrinityExperiment", "Testing", trinityAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), trinityAppId);
        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, 1, 16, 1, "development", 30, 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) 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

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