Search in sources :

Example 16 with ExperimentModel

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

the class CreateLaunchExperiment method createEchoExperimentForTrestles.

public static String createEchoExperimentForTrestles(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");
            }
        }
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
        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", "echoExperiment", "SimpleEcho3", 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(trestlesHostName)) {
                    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 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) 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 17 with ExperimentModel

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

the class CreateLaunchExperiment method createExperimentAUTODOCKStampede.

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

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

the class CreateLaunchExperiment method createExperimentWRFStampede.

public static String createExperimentWRFStampede(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), wrfAppId);
        setWRFInputs(exInputs);
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), wrfAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "WRFExperiment", "Testing", wrfAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), wrfAppId);
        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, 2, 32, 1, "development", 90, 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 19 with ExperimentModel

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

the class CreateLaunchExperiment 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 = createExperimentForSSHHost(airavata);
            // final String expId = createEchoExperimentForFSD(airavataClient);
            // final String expId = createMPIExperimentForFSD(airavataClient);
            // final String expId = createEchoExperimentForStampede(airavataClient);
            // final String expId = createEchoExperimentForTrestles(airavataClient);
            // final String expId = createExperimentEchoForLocalHost(airavataClient);
            // final String expId = createExperimentWRFTrestles(airavataClient);
            // final String expId = createExperimentForBR2(airavataClient);
            // final String expId = createExperimentForBR2Amber(airavataClient);
            // final String expId = createExperimentWRFStampede(airavataClient);
            final String expId = createExperimentForStampedeAmber(airavataClient);
            // String expId = createExperimentForTrestlesAmber(airavataClient);
            // final String expId = createExperimentGROMACSStampede(airavataClient);
            // final String expId = createExperimentESPRESSOStampede(airavataClient);
            // final String expId = createExperimentLAMMPSStampede(airavataClient);
            // final String expId = createExperimentNWCHEMStampede(airavataClient);
            // final String expId = createExperimentTRINITYStampede(airavataClient);
            // final String expId = createExperimentAUTODOCKStampede(airavataClient); // this is not working , we need to register AutoDock app on stampede
            // final String expId = createExperimentForLSF(airavataClient);
            // final String expId = createExperimentLAMMPSForLSF(airavataClient);
            // final String expId = "Ultrascan_ln_eb029947-391a-4ccf-8ace-9bafebe07cc0";
            experimentIds.add(expId);
            System.out.println("Experiment ID : " + expId);
            // updateExperiment(airavata, expId);
            launchExperiment(airavataClient, expId);
        }
        boolean allNotFinished = true;
        while (allNotFinished) {
            allNotFinished = false;
            for (String exId : experimentIds) {
                ExperimentModel experiment = airavataClient.getExperiment(new AuthzToken(""), exId);
                if (!experiment.getExperimentStatus().get(0).getState().equals(ExperimentState.COMPLETED) && !experiment.getExperimentStatus().get(0).getState().equals(ExperimentState.FAILED) && !experiment.getExperimentStatus().get(0).getState().equals(ExperimentState.CANCELED)) {
                    allNotFinished = true;
                }
                System.out.println(experiment.getExperimentId() + " " + experiment.getExperimentStatus().get(0).getState().name());
            }
            System.out.println("----------------------------------------------------");
            Thread.sleep(10000);
        }
    } 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)

Example 20 with ExperimentModel

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

the class CreateLaunchExperiment method createExperimentWRFTrestles.

public static String createExperimentWRFTrestles(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), wrfAppId);
        setWRFInputs(exInputs);
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), wrfAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "WRFExperiment", "Testing", wrfAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), wrfAppId);
        if (computeResources != null && computeResources.size() != 0) {
            for (String id : computeResources.keySet()) {
                String resourceName = computeResources.get(id);
                if (resourceName.equals(trestlesHostName)) {
                    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 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