Search in sources :

Example 36 with UserConfigurationDataModel

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

the class CreateLaunchExperiment method createExperimentNWCHEMStampede.

public static String createExperimentNWCHEMStampede(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), nwchemAppId);
        setNWCHEMInputs(exInputs);
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), nwchemAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "NWchemExperiment", "Testing", nwchemAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), nwchemAppId);
        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)

Example 37 with UserConfigurationDataModel

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

the class ExperimentModelUtil method cloneProcessFromExperiment.

public static ProcessModel cloneProcessFromExperiment(ExperimentModel experiment) {
    ProcessModel processModel = new ProcessModel();
    processModel.setCreationTime(experiment.getCreationTime());
    processModel.setExperimentId(experiment.getExperimentId());
    processModel.setApplicationInterfaceId(experiment.getExecutionId());
    processModel.setEnableEmailNotification(experiment.isEnableEmailNotification());
    List<String> emailAddresses = experiment.getEmailAddresses();
    if (emailAddresses != null && !emailAddresses.isEmpty()) {
        processModel.setEmailAddresses(emailAddresses);
    }
    List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
    if (experimentInputs != null) {
        processModel.setProcessInputs(experimentInputs);
    }
    List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
    if (experimentOutputs != null) {
        processModel.setProcessOutputs(experimentOutputs);
    }
    UserConfigurationDataModel configData = experiment.getUserConfigurationData();
    if (configData != null) {
        processModel.setStorageResourceId(configData.getStorageId());
        processModel.setExperimentDataDir(configData.getExperimentDataDir());
        processModel.setGenerateCert(configData.isGenerateCert());
        processModel.setUserDn(configData.getUserDN());
        ComputationalResourceSchedulingModel scheduling = configData.getComputationalResourceScheduling();
        if (scheduling != null) {
            processModel.setProcessResourceSchedule(scheduling);
            processModel.setComputeResourceId(scheduling.getResourceHostId());
        }
        processModel.setUseUserCRPref(configData.isUseUserCRPref());
    }
    processModel.setUserName(experiment.getUserName());
    return processModel;
}
Also used : ProcessModel(org.apache.airavata.model.process.ProcessModel) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 38 with UserConfigurationDataModel

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

the class AiravataIT method testCreateExperiment.

@org.testng.annotations.Test(priority = 5)
public void testCreateExperiment() {
    try {
        logger.info("testCreateExperiment() -> Creating test experiment.");
        tokens = readTokens();
        experimentExecution = new ExperimentExecution(setup.getAiravata(), tokens, properties);
        experimentId = experimentExecution.createLocalEchoExperiment(properties.getGname(), applicationProperties.getApplicationInterfaceId(), storageResource, computeResourceProperties.getComputeResourceId());
        Assert.assertNotNull(experimentId);
        ExperimentModel simpleExperiment = experimentExecution.getExperimentModel(experimentId);
        Assert.assertNotNull(simpleExperiment);
        UserConfigurationDataModel userConfigurationData = simpleExperiment.getUserConfigurationData();
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getResourceHostId(), computeResourceProperties.getComputeResourceId());
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getTotalCPUCount(), 4);
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getNodeCount(), 1);
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getNumberOfThreads(), 1);
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getQueueName(), "cpu");
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getWallTimeLimit(), 20);
        Assert.assertEquals(userConfigurationData.getComputationalResourceScheduling().getTotalPhysicalMemory(), 0);
        Assert.assertEquals(userConfigurationData.isAiravataAutoSchedule(), false);
        Assert.assertEquals(userConfigurationData.isOverrideManualScheduledParams(), false);
        Assert.assertEquals(userConfigurationData.getStorageId(), storageResource);
        Assert.assertEquals(userConfigurationData.getExperimentDataDir(), TestFrameworkConstants.STORAGE_LOCATION);
        logger.info("testCreateExperiment() -> Created test experiment. Experiment Id : " + experimentId);
    } catch (Exception e) {
        logger.error("Error occured while testCreateApplication", e);
        Assert.fail();
    }
}
Also used : UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel)

Aggregations

UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)38 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)35 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)35 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)34 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)33 TException (org.apache.thrift.TException)29 AuthzToken (org.apache.airavata.model.security.AuthzToken)28 Project (org.apache.airavata.model.workspace.Project)17 ArrayList (java.util.ArrayList)11 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 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 JobStatus (org.apache.airavata.model.status.JobStatus)2 RegistryException (org.apache.airavata.registry.cpi.RegistryException)2 DefaultClientConfiguration (eu.unicore.util.httpclient.DefaultClientConfiguration)1