Search in sources :

Example 11 with InputDataObjectType

use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.

the class AppInterfaceTest method createAppInput.

public InputDataObjectType createAppInput(String inputName, String value, DataType type) {
    InputDataObjectType input = new InputDataObjectType();
    input.setName(inputName);
    input.setValue(value);
    input.setType(type);
    input.setApplicationArgument("test arg");
    input.setInputOrder(order++);
    return input;
}
Also used : InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType)

Example 12 with InputDataObjectType

use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.

the class SimpleEchoIT method testSimpleLocalhostEchoService.

@Test
public void testSimpleLocalhostEchoService() throws Exception {
    log.info("Running job in localhost");
    log.info("========================");
    log.info("Adding applications...");
    DocumentCreatorNew documentCreatorNew = new DocumentCreatorNew(getClient());
    String hostAndappId = documentCreatorNew.createLocalHostDocs();
    String appId = hostAndappId.split(",")[1];
    String hostId = hostAndappId.split(",")[0];
    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 = getClient().createProject(authzToken, "php_reference_gateway", project);
    ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment("php_reference_gateway", projectId, "admin", "echoExperiment", appId, appId, exInputs);
    simpleExperiment.setExperimentOutputs(exOut);
    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 1, 1, 1, "normal", 1, 0);
    scheduling.setResourceHostId(hostId);
    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
    userConfigurationData.setAiravataAutoSchedule(false);
    userConfigurationData.setOverrideManualScheduledParams(false);
    userConfigurationData.setComputationalResourceScheduling(scheduling);
    simpleExperiment.setUserConfigurationData(userConfigurationData);
    log.info("Creating experiment...");
    final String expId = createExperiment(simpleExperiment);
    log.info("Experiment Id returned : " + expId);
    launchExperiment(expId);
    log.info("Experiment launched successfully\n");
    log.info("Monitoring job in localhost");
    log.info("===========================");
    monitorJob(expId);
}
Also used : Project(org.apache.airavata.model.workspace.Project) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) DocumentCreatorNew(org.apache.airavata.integration.tools.DocumentCreatorNew) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 13 with InputDataObjectType

use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.

the class BaseCaseIT method testEchoService.

// @Test(groups = {"setupTests"}, dependsOnMethods = {"testSetup"})
// public void testURLs() throws AiravataAPIInvocationException {
// URI eventingServiceURL = this.airavataAPI.getAiravataManager().getEventingServiceURL();
// Assert.assertNotNull(eventingServiceURL);
// 
// URI messageBoxServiceURL = this.airavataAPI.getAiravataManager().getMessageBoxServiceURL();
// Assert.assertNotNull(messageBoxServiceURL);
// }
@Test(groups = { "echoGroup" }, dependsOnGroups = { "setupTests" })
public void testEchoService() throws Exception {
    log.info("Running job in trestles...");
    DocumentCreatorNew documentCreator = new DocumentCreatorNew(client);
    documentCreator.createPBSDocsForOGCE_Echo();
    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 = getClient().createProject(authzToken, "default", project);
    ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(gatewayName, projectId, "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs);
    simpleExperiment.setExperimentOutputs(exOut);
    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0);
    scheduling.setResourceHostId("gsissh-trestles");
    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
    userConfigurationData.setAiravataAutoSchedule(false);
    userConfigurationData.setOverrideManualScheduledParams(false);
    userConfigurationData.setComputationalResourceScheduling(scheduling);
    simpleExperiment.setUserConfigurationData(userConfigurationData);
    final String expId = createExperiment(simpleExperiment);
    System.out.println("Experiment Id returned : " + expId);
    log.info("Experiment Id returned : " + expId);
    launchExperiment(expId);
    System.out.println("Launched successfully");
    Thread monitor = (new Thread() {

        public void run() {
            Map<String, JobStatus> jobStatuses = null;
            while (true) {
                try {
                    jobStatuses = client.getJobStatuses(authzToken, expId);
                    Set<String> strings = jobStatuses.keySet();
                    for (String key : strings) {
                        JobStatus jobStatus = jobStatuses.get(key);
                        if (jobStatus == null) {
                            return;
                        } else {
                            if (JobState.COMPLETE.equals(jobStatus.getJobState())) {
                                log.info("Job completed Job ID: " + key);
                                return;
                            } else {
                                log.info("Job ID:" + key + "  Job Status : " + jobStatuses.get(key).getJobState().toString());
                            }
                        }
                    }
                    Thread.sleep(5000);
                } catch (Exception e) {
                    log.error("Thread interrupted", e.getMessage());
                }
            }
        }
    });
    monitor.start();
    try {
        monitor.join();
    } catch (InterruptedException e) {
        log.error("Thread interrupted..", e.getMessage());
    }
}
Also used : Set(java.util.Set) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) JobStatus(org.apache.airavata.model.status.JobStatus) Project(org.apache.airavata.model.workspace.Project) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) DocumentCreatorNew(org.apache.airavata.integration.tools.DocumentCreatorNew) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel) Map(java.util.Map) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 14 with InputDataObjectType

use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.

the class BaseCaseIT method testEchoServiceStampede.

@Test(groups = { "echoGroup" }, dependsOnGroups = { "setupTests" })
public void testEchoServiceStampede() throws Exception {
    log.info("Running job in Stampede...");
    DocumentCreatorNew documentCreator = new DocumentCreatorNew(client);
    documentCreator.createSlurmDocs();
    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 = getClient().createProject(authzToken, "default", project);
    ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(gatewayName, projectId, "admin", "echoExperiment", "SimpleEcho3", "SimpleEcho3", exInputs);
    simpleExperiment.setExperimentOutputs(exOut);
    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 1, 1, 1, "normal", 0, 0);
    scheduling.setResourceHostId("stampede-host");
    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
    userConfigurationData.setAiravataAutoSchedule(false);
    userConfigurationData.setOverrideManualScheduledParams(false);
    userConfigurationData.setComputationalResourceScheduling(scheduling);
    simpleExperiment.setUserConfigurationData(userConfigurationData);
    final String expId = createExperiment(simpleExperiment);
    System.out.println("Experiment Id returned : " + expId);
    log.info("Experiment Id returned : " + expId);
    launchExperiment(expId);
    System.out.println("Launched successfully");
    Thread monitor = (new Thread() {

        public void run() {
            Map<String, JobStatus> jobStatuses = null;
            while (true) {
                try {
                    jobStatuses = client.getJobStatuses(authzToken, expId);
                    Set<String> strings = jobStatuses.keySet();
                    for (String key : strings) {
                        JobStatus jobStatus = jobStatuses.get(key);
                        if (jobStatus == null) {
                            return;
                        } else {
                            if (JobState.COMPLETE.equals(jobStatus.getJobState())) {
                                log.info("Job completed Job ID: " + key);
                                return;
                            } else {
                                log.info("Job ID:" + key + "  Job Status : " + jobStatuses.get(key).getJobState().toString());
                            }
                        }
                    }
                    Thread.sleep(5000);
                } catch (Exception e) {
                    log.error("Thread interrupted", e.getMessage());
                }
            }
        }
    });
    monitor.start();
    try {
        monitor.join();
    } catch (InterruptedException e) {
        log.error("Thread interrupted..", e.getMessage());
    }
}
Also used : Set(java.util.Set) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) JobStatus(org.apache.airavata.model.status.JobStatus) Project(org.apache.airavata.model.workspace.Project) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) DocumentCreatorNew(org.apache.airavata.integration.tools.DocumentCreatorNew) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel) Map(java.util.Map) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 15 with InputDataObjectType

use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.

the class ExperimentRegistry method addExpInputs.

public String addExpInputs(List<InputDataObjectType> exInputs, String experimentId) throws RegistryException {
    try {
        for (InputDataObjectType input : exInputs) {
            ExperimentInputResource resource = new ExperimentInputResource();
            resource.setExperimentId(experimentId);
            resource.setInputName(input.getName());
            resource.setInputValue(input.getValue());
            if (input.getType() != null) {
                resource.setDataType(input.getType().toString());
            }
            resource.setMetadata(input.getMetaData());
            resource.setApplicationArgument(input.getApplicationArgument());
            resource.setInputOrder(input.getInputOrder());
            resource.setIsRequired(input.isIsRequired());
            resource.setRequiredToAddedToCmd(input.isRequiredToAddedToCommandLine());
            resource.setStorageResourceId(input.getStorageResourceId());
            resource.setIsReadOnly(input.isIsReadOnly());
            resource.save();
        }
    } catch (Exception e) {
        logger.error("Unable to save experiment inputs", e);
        throw new RegistryException(e);
    }
    return experimentId;
}
Also used : InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Aggregations

InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)86 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)60 TException (org.apache.thrift.TException)49 AuthzToken (org.apache.airavata.model.security.AuthzToken)46 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)35 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)35 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)34 ArrayList (java.util.ArrayList)20 Project (org.apache.airavata.model.workspace.Project)17 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 RegistryException (org.apache.airavata.registry.cpi.RegistryException)6 HashMap (java.util.HashMap)3 DocumentCreatorNew (org.apache.airavata.integration.tools.DocumentCreatorNew)3 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)3 BeforeTest (org.testng.annotations.BeforeTest)3 Test (org.testng.annotations.Test)3 JSchException (com.jcraft.jsch.JSchException)2 Session (com.jcraft.jsch.Session)2