Search in sources :

Example 16 with UserConfigurationDataModel

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

the class ExperimentRegistry method updateExperiment.

// CPI Update Methods
public void updateExperiment(ExperimentModel experiment, String expId) throws RegistryException {
    try {
        if (!workerResource.isProjectExists(experiment.getProjectId())) {
            logger.error("Project does not exist in the system..");
            throw new Exception("Project does not exist in the system, Please create the project first...");
        }
        ExperimentResource existingExperiment = gatewayResource.getExperiment(expId);
        existingExperiment.setExperimentName(experiment.getExperimentName());
        existingExperiment.setUserName(experiment.getUserName());
        existingExperiment.setGatewayId(experiment.getGatewayId());
        existingExperiment.setGatewayExecutionId(experiment.getGatewayExecutionId());
        existingExperiment.setGatewayInstanceId(experiment.getGatewayInstanceId());
        existingExperiment.setProjectId(experiment.getProjectId());
        existingExperiment.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime()));
        existingExperiment.setDescription(experiment.getDescription());
        existingExperiment.setExecutionId(experiment.getExecutionId());
        if (experiment.isEnableEmailNotification()) {
            existingExperiment.setEnableEmailNotification(true);
            if (experiment.getEmailAddresses() != null) {
                existingExperiment.setEmailAddresses(StringUtils.join(experiment.getEmailAddresses(), ","));
            }
        } else {
            existingExperiment.setEnableEmailNotification(false);
        }
        existingExperiment.save();
        UserConfigurationDataModel userConfigurationData = experiment.getUserConfigurationData();
        if (userConfigurationData != null) {
            updateUserConfigData(userConfigurationData, expId);
        }
        List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
        if (experimentInputs != null && !experimentInputs.isEmpty()) {
            updateExpInputs(experimentInputs, expId);
        }
        List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
        if (experimentOutputs != null && !experimentOutputs.isEmpty()) {
            updateExpOutputs(experimentOutputs, expId);
        }
        List<ExperimentStatus> experimentStatuses = experiment.getExperimentStatus();
        if (experimentStatuses != null && experimentStatuses.size() > 0) {
            if (experimentStatuses.get(0) != null) {
                updateExperimentStatus(experimentStatuses.get(0), expId);
            }
        }
        List<ErrorModel> errors = experiment.getErrors();
        if (errors != null && !errors.isEmpty()) {
            for (ErrorModel errror : errors) {
                updateExperimentError(errror, expId);
            }
        }
    } catch (Exception e) {
        logger.error("Error while updating experiment...", e);
        throw new RegistryException(e);
    }
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ErrorModel(org.apache.airavata.model.commons.ErrorModel) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 17 with UserConfigurationDataModel

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

the class ThriftDataModelConversion method getUserConfigData.

public static UserConfigurationDataModel getUserConfigData(UserConfigurationDataResource resource) throws RegistryException {
    if (resource != null) {
        UserConfigurationDataModel data = new UserConfigurationDataModel();
        data.setAiravataAutoSchedule(resource.getAiravataAutoSchedule());
        data.setOverrideManualScheduledParams(resource.getOverrideManualScheduledParams());
        data.setShareExperimentPublicly(resource.getShareExperimentPublically());
        data.setUserDN(resource.getUserDn());
        data.setGenerateCert(resource.getGenerateCert());
        data.setStorageId(resource.getStorageId());
        data.setExperimentDataDir(resource.getExperimentDataDir());
        data.setUseUserCRPref(resource.getUseUserCRPref());
        ComputationalResourceSchedulingModel resourceSchedulingModel = new ComputationalResourceSchedulingModel();
        resourceSchedulingModel.setResourceHostId(resource.getResourceHostId());
        resourceSchedulingModel.setTotalCPUCount(resource.getTotalCpuCount());
        resourceSchedulingModel.setNodeCount(resource.getNodeCount());
        resourceSchedulingModel.setNumberOfThreads(resource.getNumberOfThreads());
        resourceSchedulingModel.setQueueName(resource.getQueueName());
        resourceSchedulingModel.setWallTimeLimit(resource.getWallTimeLimit());
        resourceSchedulingModel.setTotalPhysicalMemory(resource.getTotalPhysicalMemory());
        resourceSchedulingModel.setStaticWorkingDir(resource.getStaticWorkingDir());
        resourceSchedulingModel.setOverrideLoginUserName(resource.getOverrideLoginUserName());
        resourceSchedulingModel.setOverrideScratchLocation(resource.getOverrideScratchLocation());
        resourceSchedulingModel.setOverrideAllocationProjectNumber(resource.getOverrideAllocationProjectNumber());
        data.setComputationalResourceScheduling(resourceSchedulingModel);
        return data;
    }
    return null;
}
Also used : UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 18 with UserConfigurationDataModel

use of org.apache.airavata.model.experiment.UserConfigurationDataModel 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 19 with UserConfigurationDataModel

use of org.apache.airavata.model.experiment.UserConfigurationDataModel 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 20 with UserConfigurationDataModel

use of org.apache.airavata.model.experiment.UserConfigurationDataModel 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)

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