updating document creator method signatures
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/5e3f0cfd Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/5e3f0cfd Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/5e3f0cfd Branch: refs/heads/master Commit: 5e3f0cfdc8622d72c85584e88338b8451ed5032b Parents: 8718d94 Author: chathuri <[email protected]> Authored: Thu Mar 6 12:12:55 2014 -0500 Committer: chathuri <[email protected]> Committed: Thu Mar 6 12:12:55 2014 -0500 ---------------------------------------------------------------------- .../client/samples/CreateLaunchExperiment.java | 50 ++++++++++++++++++-- .../airavata/client/tools/DocumentCreator.java | 6 +-- .../client/OrchestratorClientFactoryTest.java | 6 +-- .../client/sample/OrchestratorClientSample.java | 2 +- .../orchestrator/core/BaseOrchestratorTest.java | 7 ++- 5 files changed, 56 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/5e3f0cfd/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index 63184d3..5d8c69b 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -61,7 +61,7 @@ public class CreateLaunchExperiment { final Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); System.out.println("API version is " + airavata.GetAPIVersion()); addDescriptors(); - final String expId = createExperiment(airavata); + final String expId = createLocalExperiment(airavata); System.out.println("Experiment ID : " + expId); launchExperiment(airavata, expId); System.out.println("Launched successfully"); @@ -121,9 +121,9 @@ public class CreateLaunchExperiment { public static void addDescriptors() throws AiravataAPIInvocationException,ApplicationSettingsException { try { DocumentCreator documentCreator = new DocumentCreator(getAiravataAPI()); - documentCreator.createLocalHostDocs(); - documentCreator.createGramDocs(); - documentCreator.createGSISSHDocs(); + documentCreator.createEchoAppLocalHostDocs(); +// documentCreator.createEchoAppGramDocs(); +// documentCreator.createEchoAppGSISSHDocs(); } catch (AiravataAPIInvocationException e) { logger.error("Unable to create airavata API", e.getMessage()); throw new AiravataAPIInvocationException(e); @@ -191,6 +191,48 @@ public class CreateLaunchExperiment { } } + public static String createLocalExperiment (Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException { + try{ + List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); + DataObjectType input = new DataObjectType(); + input.setKey("echo_input"); + input.setType(DataType.STRING.toString()); + input.setValue("echo_output=Hello World"); + exInputs.add(input); + + List<DataObjectType> exOut = new ArrayList<DataObjectType>(); + DataObjectType output = new DataObjectType(); + output.setKey("echo_output"); + output.setType(DataType.STRING.toString()); + output.setValue(""); + exOut.add(output); + + Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment", "Echo", "Echo", exInputs); + simpleExperiment.setExperimentOutputs(exOut); + + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("localhost", 1, 1, 1, "normal", 0, 0, 1, "sds128"); + scheduling.setResourceHostId("localhost"); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + userConfigurationData.setAiravataAutoSchedule(false); + userConfigurationData.setOverrideManualScheduledParams(false); + userConfigurationData.setComputationalResourceScheduling(scheduling); + simpleExperiment.setUserConfigurationData(userConfigurationData); + return client.createExperiment(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); + } + } + public static void launchExperiment (Airavata.Client client, String expId) throws ExperimentNotFoundException, AiravataSystemException, InvalidRequestException,AiravataClientException, TException{ try { http://git-wip-us.apache.org/repos/asf/airavata/blob/5e3f0cfd/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java index 393e214..7d63aae 100644 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java +++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java @@ -47,7 +47,7 @@ public class DocumentCreator { this.airavataAPI = airavataAPI; } - public void createLocalHostDocs() { + public void createEchoAppLocalHostDocs() { HostDescription descriptor = new HostDescription(); descriptor.getType().setHostName("localhost"); descriptor.getType().setHostAddress("127.0.0.1"); @@ -105,7 +105,7 @@ public class DocumentCreator { } - public void createGramDocs() { + public void createEchoAppGramDocs() { /* creating host descriptor for gram */ @@ -208,7 +208,7 @@ public class DocumentCreator { } } - public void createGSISSHDocs() { + public void createEchoAppGSISSHDocs() { HostDescription host = new HostDescription(GsisshHostType.type); host.getType().setHostAddress(hpcHostAddress); host.getType().setHostName(gsiSshHostName); http://git-wip-us.apache.org/repos/asf/airavata/blob/5e3f0cfd/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java index 829f25b..f04f02e 100644 --- a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java +++ b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java @@ -56,9 +56,9 @@ public class OrchestratorClientFactoryTest { registry = RegistryFactory.getDefaultRegistry(); AiravataUtils.setExecutionAsServer(); documentCreator = new DocumentCreator(getAiravataAPI()); - documentCreator.createLocalHostDocs(); - documentCreator.createGramDocs(); - documentCreator.createGSISSHDocs(); + documentCreator.createEchoAppLocalHostDocs(); + documentCreator.createEchoAppGramDocs(); + documentCreator.createEchoAppGSISSHDocs(); } private AiravataAPI getAiravataAPI() { http://git-wip-us.apache.org/repos/asf/airavata/blob/5e3f0cfd/modules/orchestrator/orchestrator-client-sdks/src/main/java/org/apache/airavata/orchestrator/client/sample/OrchestratorClientSample.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-client-sdks/src/main/java/org/apache/airavata/orchestrator/client/sample/OrchestratorClientSample.java b/modules/orchestrator/orchestrator-client-sdks/src/main/java/org/apache/airavata/orchestrator/client/sample/OrchestratorClientSample.java index 0414e57..2195922 100644 --- a/modules/orchestrator/orchestrator-client-sdks/src/main/java/org/apache/airavata/orchestrator/client/sample/OrchestratorClientSample.java +++ b/modules/orchestrator/orchestrator-client-sdks/src/main/java/org/apache/airavata/orchestrator/client/sample/OrchestratorClientSample.java @@ -65,7 +65,7 @@ public class OrchestratorClientSample { orchestratorClient = OrchestratorClientFactory.createOrchestratorClient("localhost", 8940); registry = RegistryFactory.getRegistry(gateway, sysUser, sysUserPwd); documentCreator = new DocumentCreator(getAiravataAPI()); - documentCreator.createLocalHostDocs(); + documentCreator.createEchoAppLocalHostDocs(); // documentCreator.createGramDocs(); // documentCreator.createGSISSHDocs(); storeExperimentDetail(); http://git-wip-us.apache.org/repos/asf/airavata/blob/5e3f0cfd/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/BaseOrchestratorTest.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/BaseOrchestratorTest.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/BaseOrchestratorTest.java index 1b20e19..db95c8d 100644 --- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/BaseOrchestratorTest.java +++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/BaseOrchestratorTest.java @@ -28,7 +28,6 @@ import org.apache.airavata.client.tools.DocumentCreator; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.orchestrator.core.util.Initialize; -import org.apache.airavata.persistance.registry.jpa.ResourceType; import org.apache.airavata.persistance.registry.jpa.ResourceUtils; import org.apache.airavata.persistance.registry.jpa.resources.*; @@ -50,9 +49,9 @@ public class BaseOrchestratorTest { userResource.setPassword("admin"); documentCreator = new DocumentCreator(getAiravataAPI()); - documentCreator.createLocalHostDocs(); - documentCreator.createGramDocs(); - documentCreator.createGSISSHDocs(); + documentCreator.createEchoAppLocalHostDocs(); + documentCreator.createEchoAppGramDocs(); + documentCreator.createEchoAppGSISSHDocs(); } public void tearDown() throws Exception {
