You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2017/01/27 20:41:19 UTC
[03/11] airavata git commit:
modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-server-stop.sh
modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-server-stop.sh
Register gateway, compute resource, storage resource, application and launch application
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ce359dc0
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ce359dc0
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ce359dc0
Branch: refs/heads/develop
Commit: ce359dc0f086dcc5719b2ec42237e7f1d505b135
Parents: 2cb5ebc
Author: Ajinkya Dhamnaskar <ad...@umail.iu.edu>
Authored: Sun Dec 18 13:44:43 2016 -0500
Committer: Ajinkya Dhamnaskar <ad...@umail.iu.edu>
Committed: Sun Dec 18 13:44:43 2016 -0500
----------------------------------------------------------------------
.../multitenantedairavata/AiravataClient.java | 4 +-
.../multitenantedairavata/AiravataIT.java | 380 +++++++++++++
.../ApplicationRegister.java | 325 +++--------
.../ComputeResourceRegister.java | 163 ++----
.../ExperimentExecution.java | 563 +++++--------------
.../multitenantedairavata/FrameworkSetup.java | 10 +-
.../multitenantedairavata/GatewayRegister.java | 137 +++--
.../StorageResourceRegister.java | 151 +++++
.../TestFrameworkProps.java | 8 -
.../utils/ApplicationProperties.java | 39 ++
.../utils/ComputeResourceProperties.java | 35 ++
.../utils/PropertyFileType.java | 2 +-
.../utils/PropertyReader.java | 6 +-
.../utils/TestFrameworkConstants.java | 97 ++--
.../main/resources/airavata-server.properties | 336 +++++++++++
.../src/main/resources/airavata_sym.jks | Bin 0 -> 501 bytes
.../local-exp-resources/wrapper/echo_wrapper.sh | 7 +
.../src/main/resources/log4j.properties | 41 ++
.../src/main/resources/startup-airavata.sh | 8 +
19 files changed, 1403 insertions(+), 909 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/ce359dc0/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
index 8b4b48b..82710dd 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
@@ -47,8 +47,8 @@ public class AiravataClient {
public Airavata.Client getAiravataClient() throws Exception{
try {
- String airavataHost = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_HOST, PropertyFileType.AIRAVATA_CLIENT);
- int airavataport = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_PORT, PropertyFileType.AIRAVATA_CLIENT));
+ String airavataHost = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_HOST, PropertyFileType.AIRAVATA_SERVER);
+ int airavataport = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_PORT, PropertyFileType.AIRAVATA_SERVER));
airavataClient = AiravataClientFactory.createAiravataClient(airavataHost, airavataport);
return airavataClient;
} catch (AiravataClientException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/ce359dc0/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataIT.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataIT.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataIT.java
new file mode 100644
index 0000000..24a0d96
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataIT.java
@@ -0,0 +1,380 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.testsuite.multitenantedairavata;
+
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
+import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
+import org.apache.airavata.model.application.io.DataType;
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+import org.apache.airavata.model.data.movement.DataMovementProtocol;
+import org.apache.airavata.model.data.movement.SecurityProtocol;
+import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.model.experiment.UserConfigurationDataModel;
+import org.apache.airavata.model.parallelism.ApplicationParallelismType;
+import org.apache.airavata.model.status.ExperimentState;
+import org.apache.airavata.model.status.ExperimentStatus;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.GatewayApprovalStatus;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.ApplicationProperties;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.ComputeResourceProperties;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_VERSION;
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.LocalEchoProperties.*;
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.LocalEchoProperties.LocalApplication.*;
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.LocalEchoProperties.LocalEchoComputeResource.*;
+
+public class AiravataIT {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataIT.class);
+ private static TestFrameworkProps properties;
+ private static Map<String, String> tokens;
+ private static ExperimentExecution experimentExecution;
+ private FrameworkSetup setup;
+ private Object lock = new Object();
+ private String storageResource;
+ private ComputeResourceProperties computeResourceProperties;
+ private ApplicationProperties applicationProperties;
+ private String experimentId;
+
+ @BeforeTest
+ public void setupAiravata(){
+ Process p;
+ try {
+ logger.info("setupAiravata() -> Starting airavata.......");
+ p = Runtime.getRuntime().exec("./airavata-server-stop.sh -f");
+ p = Runtime.getRuntime().exec("./startup-airavata.sh");
+ Thread.sleep(15000);
+ setup = FrameworkSetup.getInstance();
+ properties = setup.getTestFrameworkProps();
+ logger.info("setupAiravata() -> Started airavata.");
+ } catch (Exception e) {
+ logger.error("Error occured while set up", e);
+ Assert.fail();
+ }
+ }
+
+ @org.testng.annotations.Test(priority=1)
+ public void testCreateGateway(){
+ try {
+ logger.info("testCreateGateway() -> Creating test gateway......");
+ setup.getGatewayRegister().createGateway();
+ GatewayResourceProfile gatewayResourceProfile = setup.getGatewayRegister().getGatewayResourceProfile();
+ Assert.assertNotNull(gatewayResourceProfile);
+ Gateway testGateway = setup.getGatewayRegister().getGateway(properties.getGname());
+ Assert.assertNotNull(testGateway);
+ Assert.assertEquals(testGateway.getGatewayName(), properties.getGname());
+ Assert.assertEquals(testGateway.getDomain(), properties.getGname() + properties.getGdomain());
+ Assert.assertEquals(testGateway.getGatewayApprovalStatus(), GatewayApprovalStatus.APPROVED);
+
+ String createdToken = setup.getGatewayRegister().writeToken();
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(properties.getTokenFileLoc()+ File.separator + TestFrameworkConstants.CredentialStoreConstants.TOKEN_FILE_NAME))), createdToken);
+ /*
+ TODO: Not required for local setup
+ FIXME: for scp transfer
+ Currently credential store does not support jpa its plane sql and need
+ */
+ //setup.getGatewayRegister().registerSSHKeys();
+
+ logger.info("testCreateGateway() -> Created test gateway. Gateway Id : " + properties.getGname());
+ } catch (Exception e) {
+ logger.error("Error occured while testCreateGateways", e);
+ Assert.fail();
+ }
+ }
+
+ @org.testng.annotations.Test(priority=2)
+ public void testComputeResource(){
+ try {
+
+ logger.info("testComputeResource() -> Creating test compute resource......");
+
+ computeResourceProperties = setup.getComputeResourceRegister().addComputeResources();
+ Assert.assertNotNull(computeResourceProperties);
+
+ Assert.assertNotNull(computeResourceProperties.getComputeResourceId());
+ Assert.assertNotNull(computeResourceProperties.getJobSubmissionId());
+
+
+ ComputeResourceDescription computeResourceDescription = setup.getComputeResourceRegister().getComputeResource(computeResourceProperties.getComputeResourceId());
+ Assert.assertNotNull(computeResourceDescription.getHostName(), HOST_NAME);
+ Assert.assertNotNull(computeResourceDescription.getResourceDescription(), HOST_DESC);
+
+ LOCALSubmission localSubmission = setup.getComputeResourceRegister().getLocalSubmission(computeResourceProperties.getJobSubmissionId());
+
+ Assert.assertEquals(localSubmission.getResourceJobManager().getResourceJobManagerType(), ResourceJobManagerType.FORK);
+ Assert.assertEquals(localSubmission.getSecurityProtocol(), SecurityProtocol.LOCAL);
+ Assert.assertEquals(localSubmission.getResourceJobManager().getPushMonitoringEndpoint(), null);
+ Assert.assertEquals(localSubmission.getResourceJobManager().getJobManagerBinPath(), "");
+ Assert.assertEquals(localSubmission.getResourceJobManager().getJobManagerCommands().get(JobManagerCommand.SUBMISSION), JOB_MANAGER_COMMAND);
+
+ setup.getComputeResourceRegister().registerGatewayResourceProfile(computeResourceProperties.getComputeResourceId());
+
+ ComputeResourcePreference computeResourcePreference = setup.getComputeResourceRegister().getGatewayComputeResourcePreference(properties.getGname(), computeResourceProperties.getComputeResourceId());
+
+ Assert.assertEquals(computeResourcePreference.getAllocationProjectNumber(), ALLOCATION_PROJECT_NUMBER);
+ Assert.assertEquals(computeResourcePreference.getPreferredBatchQueue(), BATCH_QUEUE);
+ Assert.assertEquals(computeResourcePreference.getPreferredDataMovementProtocol(), DataMovementProtocol.LOCAL);
+ Assert.assertEquals(computeResourcePreference.getPreferredJobSubmissionProtocol(), JobSubmissionProtocol.LOCAL);
+ Assert.assertEquals(computeResourcePreference.getScratchLocation(), TestFrameworkConstants.SCRATCH_LOCATION);
+ Assert.assertEquals(computeResourcePreference.getLoginUserName(), LOGIN_USER);
+
+ logger.info("testComputeResource() -> Created test compute resource." + computeResourceProperties.toString());
+
+ } catch (Exception e) {
+ logger.error("Error occured while testComputeResource", e);
+ Assert.fail();
+ }
+ }
+
+
+ @org.testng.annotations.Test(priority=3)
+ public void testStorageResource(){
+ try {
+
+ logger.info("testStorageResource() -> Creating test storage resource......");
+
+ storageResource = setup.getStorageResourceRegister().addStorageResourceResource();;
+ Assert.assertNotNull(storageResource);
+
+ StorageResourceDescription storageResourceDescription = setup.getStorageResourceRegister().getStorageResourceDescription(storageResource);
+ Assert.assertNotNull(storageResourceDescription.getHostName(), HOST_NAME);
+ Assert.assertNotNull(storageResourceDescription.getStorageResourceDescription(), HOST_DESC);
+
+ setup.getStorageResourceRegister().registerGatewayStorageProfile(storageResource);
+
+ StoragePreference storagePreference = setup.getStorageResourceRegister().getStoragePreference(properties.getGname(), storageResource);
+
+ Assert.assertEquals(storagePreference.getLoginUserName(), LOGIN_USER);
+ Assert.assertEquals(storagePreference.getFileSystemRootLocation(), TestFrameworkConstants.STORAGE_LOCATION);
+
+ logger.info("testStorageResource() -> Created test storage resource. Storage Resource Id : " + storageResource);
+
+ } catch (Exception e) {
+ logger.error("Error occured while testStorageResource", e);
+ Assert.fail();
+ }
+ }
+
+
+
+ @org.testng.annotations.Test(priority=4)
+ public void testAddApplication(){
+ try {
+
+ logger.info("testAddApplication() -> Adding test application......");
+
+ applicationProperties = setup.getApplicationRegister().addApplications();;
+ Assert.assertNotNull(applicationProperties);
+
+ ApplicationModule applicationModule = setup.getApplicationRegister().getApplicationModule(applicationProperties.getApplicationModuleId());
+ Assert.assertNotNull(applicationModule);
+ Assert.assertEquals(applicationModule.getAppModuleName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
+ Assert.assertEquals(applicationModule.getAppModuleVersion(), LOCAL_ECHO_VERSION);
+ Assert.assertEquals(applicationModule.getAppModuleDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
+ Assert.assertEquals(applicationModule.getAppModuleName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
+
+
+ ApplicationInterfaceDescription applicationInterfaceDescription = setup.getApplicationRegister().getApplicationInterfaceDescription(applicationProperties.getApplicationInterfaceId());
+ Assert.assertNotNull(applicationInterfaceDescription);
+ Assert.assertEquals(applicationInterfaceDescription.getApplicationName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
+ Assert.assertEquals(applicationInterfaceDescription.getApplicationDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
+
+ InputDataObjectType input = applicationInterfaceDescription.getApplicationInputs().get(0);
+ Assert.assertNotNull(input);
+ Assert.assertEquals(input.getName(), INPUT_NAME);
+ Assert.assertEquals(input.getValue(), INPUT_VALUE);
+ Assert.assertEquals(input.getType(), DataType.STRING);
+ Assert.assertEquals(input.getApplicationArgument(), null);
+ Assert.assertEquals(input.getInputOrder(), 0);
+ Assert.assertEquals(input.isIsRequired(), true);
+ Assert.assertEquals(input.isRequiredToAddedToCommandLine(), true);
+ Assert.assertEquals(input.isStandardInput(), false);
+ Assert.assertEquals(input.getUserFriendlyDescription(), INPUT_DESC);
+ Assert.assertEquals(input.getMetaData(), null);
+
+ List<OutputDataObjectType> outputDataObjectTypes = applicationInterfaceDescription.getApplicationOutputs();
+ Assert.assertNotNull(outputDataObjectTypes.get(0));
+ Assert.assertEquals(outputDataObjectTypes.get(0).getName(), STDERR_NAME);
+ Assert.assertEquals(outputDataObjectTypes.get(0).getValue(), STDERR_VALUE);
+ Assert.assertEquals(outputDataObjectTypes.get(0).getType(), DataType.URI);
+ Assert.assertEquals(outputDataObjectTypes.get(0).isIsRequired(), true);
+ Assert.assertEquals(outputDataObjectTypes.get(0).isRequiredToAddedToCommandLine(), true);
+ Assert.assertEquals(outputDataObjectTypes.get(0).getApplicationArgument(), null);
+
+
+ Assert.assertNotNull(outputDataObjectTypes.get(1));
+ Assert.assertEquals(outputDataObjectTypes.get(1).getName(), STDOUT_NAME);
+ Assert.assertEquals(outputDataObjectTypes.get(1).getValue(), STDOUT_VALUE);
+ Assert.assertEquals(outputDataObjectTypes.get(1).getType(), DataType.URI);
+ Assert.assertEquals(outputDataObjectTypes.get(1).isIsRequired(), true);
+ Assert.assertEquals(outputDataObjectTypes.get(1).isRequiredToAddedToCommandLine(), true);
+ Assert.assertEquals(outputDataObjectTypes.get(1).getApplicationArgument(), null);
+
+
+
+ ApplicationDeploymentDescription applicationDeploymentDescription = setup.getApplicationRegister().getApplicationDeploymentDescription(applicationProperties.getApplicationDeployId());
+ Assert.assertNotNull(applicationDeploymentDescription);
+
+ Assert.assertEquals(applicationDeploymentDescription.getExecutablePath(), TestFrameworkConstants.LOCAL_ECHO_JOB_FILE_PATH);
+ Assert.assertEquals(applicationDeploymentDescription.getParallelism(), ApplicationParallelismType.SERIAL);
+ Assert.assertEquals(applicationDeploymentDescription.getAppDeploymentDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
+ Assert.assertEquals(applicationDeploymentDescription.getModuleLoadCmds(), null);
+ Assert.assertEquals(applicationDeploymentDescription.getPostJobCommands(), null);
+ Assert.assertEquals(applicationDeploymentDescription.getPreJobCommands(), null);
+
+ logger.info("testAddApplication() -> Adding test application." + applicationProperties.toString());
+
+ } catch (Exception e) {
+ logger.error("Error occured while testAddApplication", e);
+ Assert.fail();
+ }
+ }
+
+ @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();
+ }
+ }
+
+ @org.testng.annotations.Test(priority=6)
+ public void testLaunchExperiment(){
+ try {
+
+ logger.info("testLaunchExperiment() -> Launching test experiment......");
+
+ experimentExecution.launchExperiments(properties.getGname(), experimentId);
+ experimentExecution.monitorExperiments();
+ ExperimentStatus experimentStatus = experimentExecution.getExperimentStatus(experimentId);
+ int maxTry = 5;
+ while( maxTry != 0 && !experimentStatus.getState().equals(ExperimentState.COMPLETED) && !experimentStatus.getState().equals(ExperimentState.FAILED)){
+ experimentStatus = experimentExecution.getExperimentStatus(experimentId);
+ maxTry--;
+ Thread.sleep(2000);
+ }
+ if(experimentStatus.getState().equals(ExperimentState.COMPLETED)){
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(TestFrameworkConstants.STORAGE_LOCATION +"stdout.txt"))), LOCAL_ECHO_EXPERIMENT_EXPECTED_OUTPUT+"\n");
+ logger.info("testLaunchExperiment() -> Test experiment completed");
+ }else if(experimentStatus.getState().equals(ExperimentState.FAILED)) {
+ Assert.fail("Experiment failed to execute");
+ }else{
+ Assert.fail("Failed to execute experiment in 10 seconds.");
+ }
+ } catch (Exception e) {
+ logger.error("Error occured while testLaunchExperiment", e);
+ Assert.fail();
+ }
+ }
+
+ @AfterTest(alwaysRun = true)
+ private void cleanUp(){
+ logger.info("cleanUp() -> Launching test experiment......");
+ Process p;
+ try {
+ String result = null;
+ p = Runtime.getRuntime().exec("base-airavata/apache-airavata-server-0.17-SNAPSHOT/bin/airavata-server-stop.sh -f");
+ BufferedReader br = new BufferedReader(
+ new InputStreamReader(p.getInputStream()));
+ while ((result = br.readLine()) != null)
+ System.out.println("line: " + result);
+ p.waitFor();
+ System.out.println ("exit: " + p.exitValue());
+ p.destroy();
+ } catch (Exception e) {
+ logger.error("Error occured while cleanup", e);
+ Assert.fail();
+ }
+
+ }
+
+ public Map<String, String> readTokens () throws Exception{
+ Map<String, String> tokens = new HashMap<String, String>();
+ String fileLocation = properties.getTokenFileLoc();
+ String fileName = TestFrameworkConstants.CredentialStoreConstants.TOKEN_FILE_NAME;
+ String path = fileLocation + File.separator + fileName;
+ File tokenFile = new File(path);
+ if (tokenFile.exists()){
+ FileInputStream fis = new FileInputStream(tokenFile);
+ BufferedReader br = new BufferedReader(new InputStreamReader(fis));
+
+ String line;
+ while ((line = br.readLine()) != null) {
+ String[] strings = line.split(":");
+ tokens.put(strings[0], strings[1]);
+ }
+ br.close();
+ }else {
+ throw new Exception("Could not find token file.. Please run application registration step if you haven't run it");
+ }
+ return tokens;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ce359dc0/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
index 5fa6ad3..0b286ea 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
@@ -32,8 +32,10 @@ import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.model.parallelism.ApplicationParallelismType;
import org.apache.airavata.model.security.AuthzToken;
import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.ApplicationProperties;
import org.apache.airavata.testsuite.multitenantedairavata.utils.FrameworkUtils;
import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
+import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,29 +44,27 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.LocalEchoProperties.LocalApplication.*;
+
public class ApplicationRegister {
private Airavata.Client airavata;
- private List<Gateway> allGateways;
+ private List<Gateway> gateways;
private Map<String, String> applicationInterfaceListPerGateway;
private Map<String, String> applicationDeployementListPerGateway;
private final static Logger logger = LoggerFactory.getLogger(ApplicationRegister.class);
- private String stampedeResourceId;
- private String trestlesResourceId;
- private String br2ResourceId;
- private String gordenResourceId;
- private String alamoResourceId;
- private List<String> gatewaysToAvoid;
+ private String localResourceId;
private AuthzToken authzToken;
+ private TestFrameworkProps props;
public ApplicationRegister(Airavata.Client airavata, TestFrameworkProps props) throws Exception {
this.airavata = airavata;
authzToken = new AuthzToken("emptyToken");
- allGateways = getAllGateways(airavata);
+ gateways = getAllGateways(airavata);
applicationInterfaceListPerGateway = new HashMap<String, String>();
applicationDeployementListPerGateway = new HashMap<String, String>();
FrameworkUtils frameworkUtils = FrameworkUtils.getInstance();
- gatewaysToAvoid = frameworkUtils.getGatewayListToAvoid(props.getSkippedGateways());
+ this.props = props;
}
public List<Gateway> getAllGateways(Airavata.Client client) throws Exception{
@@ -76,288 +76,91 @@ public class ApplicationRegister {
}
}
- public void addApplications () throws Exception{
+ public ApplicationProperties addApplications () throws Exception{
Map<String, String> allComputeResourceNames = airavata.getAllComputeResourceNames(authzToken);
System.out.println("All compute resources :" + allComputeResourceNames.size());
for (String resourceId : allComputeResourceNames.keySet()){
String resourceName = allComputeResourceNames.get(resourceId);
- if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)){
- stampedeResourceId = resourceId;
- }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)){
- br2ResourceId = resourceId;
- }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.GORDEN_RESOURCE_NAME)){
- gordenResourceId = resourceId;
- }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.ALAMO_RESOURCE_NAME)){
- alamoResourceId = resourceId;
+ if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.LOCAL_RESOURCE_NAME)){
+ localResourceId = resourceId;
}
}
-// addUltrascanApplication();
- addAmberApplication();
- addEchoApplication();
- addLAMMPSApplication();
- }
-
- protected void addAmberApplication () throws Exception{
- for (Gateway gateway : allGateways) {
- boolean isgatewayValid = true;
- for (String ovoidGateway : gatewaysToAvoid){
- if (gateway.getGatewayId().equals(ovoidGateway)){
- isgatewayValid = false;
- break;
- }
- }
- if (isgatewayValid) {
- // add amber module
- String amberModuleId = airavata.registerApplicationModule(authzToken, gateway.getGatewayId(),
- createApplicationModule(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME, "12.0", TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION));
- System.out.println("Amber Module Id " + amberModuleId);
-
- // add amber interface
- String amberInterfaceId = registerAmberInterface(gateway, amberModuleId);
- applicationInterfaceListPerGateway.put(amberInterfaceId, gateway.getGatewayId());
-
- // add amber deployment
- List<CommandObject> moduleLoadCMDs = new ArrayList();
- CommandObject cmd = new CommandObject();
- cmd.setCommand("module load amber");
- cmd.setCommandOrder(0);
- moduleLoadCMDs.add(cmd);
- ApplicationDeploymentDescription amberStampedeDeployment = createApplicationDeployment(amberModuleId, stampedeResourceId,
- "/opt/apps/intel13/mvapich2_1_9/amber/12.0/bin/sander.MPI -O", ApplicationParallelismType.MPI,
- TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, moduleLoadCMDs, null, null);
- String amberStampedeAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), amberStampedeDeployment);
-
- String amberTrestlesAppDeployId = airavata.registerApplicationDeployment(authzToken,gateway.getGatewayId(),
- createApplicationDeployment(amberModuleId, trestlesResourceId,
- "/opt/amber/bin/sander.MPI -O", ApplicationParallelismType.MPI,
- TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, moduleLoadCMDs, null, null));
-
- List<CommandObject> amberModuleLoadCMDsBr2 = new ArrayList<>();
- cmd = new CommandObject();
- cmd.setCommand("module load amber/gnu/mpi/12");
- cmd.setCommandOrder(0);
- amberModuleLoadCMDsBr2.add(cmd);
-
- cmd = new CommandObject();
- cmd.setCommand("module swap PrgEnv-cray PrgEnv-gnu");
- cmd.setCommandOrder(1);
- amberModuleLoadCMDsBr2.add(cmd);
- amberModuleLoadCMDsBr2.add(cmd);
-
- String amberBr2AppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(amberModuleId, br2ResourceId,
- "/N/soft/cle4/amber/gnu/mpi/12/amber12/bin/sander.MPI -O", ApplicationParallelismType.MPI,
- TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, amberModuleLoadCMDsBr2, null, null));
-
- applicationDeployementListPerGateway.put(amberStampedeAppDeployId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(amberTrestlesAppDeployId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(amberBr2AppDeployId, gateway.getGatewayId());
- }
- }
-
-
+ return addLocalEchoApplication();
}
- protected void addUltrascanApplication () throws Exception{
- for (Gateway gateway : allGateways) {
- boolean isgatewayValid = true;
- for (String ovoidGateway : gatewaysToAvoid){
- if (gateway.getGatewayId().equals(ovoidGateway)){
- isgatewayValid = false;
- break;
- }
- }
- if (isgatewayValid) {
- // add amber module
- String ultrascanModuleId = airavata.registerApplicationModule(authzToken, gateway.getGatewayId(),
- createApplicationModule(TestFrameworkConstants.AppcatalogConstants.ULTRASCAN, "1.0", TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION));
- System.out.println("Ultrascan module Id " + ultrascanModuleId);
-
- // add amber interface
- String ultrascanInterfaceId = registerUltrascanInterface(gateway, ultrascanModuleId);
- applicationInterfaceListPerGateway.put(ultrascanInterfaceId, gateway.getGatewayId());
-
- // add amber deployment
- ApplicationDeploymentDescription ultrascanStampedeDeployment = createApplicationDeployment(ultrascanModuleId, stampedeResourceId,
- "/home1/01623/us3/bin/us_mpi_analysis", ApplicationParallelismType.MPI,
- TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, null, null, null);
- String ultrascanStampedeAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), ultrascanStampedeDeployment);
-
- String ultrascanTrestlesAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(ultrascanModuleId, trestlesResourceId,
- "/home/us3/trestles/bin/us_mpi_analysis", ApplicationParallelismType.MPI,
- TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, null, null, null));
-
- String ultrascanGordenAppDepId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(ultrascanModuleId,gordenResourceId,
- "/home/us3/gordon/bin/us_mpi_analysis", ApplicationParallelismType.MPI,
- TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, null, null, null));
-
- List<CommandObject> alamoModules = new ArrayList<>();
- CommandObject cmd = new CommandObject("module load intel/2015/64");
- alamoModules.add(cmd);
- cmd = new CommandObject("module load openmpi/intel/1.8.4");
- alamoModules.add(cmd);
- cmd = new CommandObject("module load qt4/4.8.6");
- alamoModules.add(cmd);
- cmd = new CommandObject("module load ultrascan3/3.3");
- alamoModules.add(cmd);
-
- String ultrascanAlamoAppId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(ultrascanModuleId,alamoResourceId,
- "/home/us3/bin/us_mpi_analysis", ApplicationParallelismType.OPENMP,
- TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, alamoModules, null, null));
-
- applicationDeployementListPerGateway.put(ultrascanStampedeAppDeployId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(ultrascanTrestlesAppDeployId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(ultrascanGordenAppDepId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(ultrascanAlamoAppId, gateway.getGatewayId());
- }
- }
- }
+ private ApplicationProperties addLocalEchoApplication() throws Exception{
+ Gateway testGateway = airavata.getGateway(authzToken, props.getGname());
- private String registerUltrascanInterface(Gateway gateway, String ultrascanModuleId) throws org.apache.thrift.TException {
- List<String> appModules = new ArrayList<String>();
- appModules.add(ultrascanModuleId);
+ String localEchoModuleId = airavata.registerApplicationModule(authzToken, props.getGname(),
+ createApplicationModule(TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME, TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_VERSION, TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION));
+ System.out.println("Echo Module Id " + localEchoModuleId);
- InputDataObjectType input1 = createAppInput("input", null,
- DataType.URI, null, 1, true, true,false, "Input tar file", null);
+ String echoInterfaceId = registerLocalEchoInterface(testGateway, localEchoModuleId);
+ applicationInterfaceListPerGateway.put(echoInterfaceId, testGateway.getGatewayId());
- InputDataObjectType input2 = createAppInput("mgroupcount", "-mgroupcount=1",
- DataType.STRING, null, 3, true, true,false, "mgroupcount", null);
+ String echoLocalAppDeployId = airavata.registerApplicationDeployment(authzToken, testGateway.getGatewayId(),
+ createApplicationDeployment(localEchoModuleId, localResourceId,
+ TestFrameworkConstants.LOCAL_ECHO_JOB_FILE_PATH, ApplicationParallelismType.SERIAL,
+ TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION, null, null, null));
- InputDataObjectType input3 = createAppInput("walltime", "-walltime=60",
- DataType.STRING, null, 2, true, true,false, "walltime", null);
- List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
- applicationInputs.add(input1);
- applicationInputs.add(input2);
- applicationInputs.add(input3);
-
- OutputDataObjectType output1 = createAppOutput("ultrascanOutput", "analysis-results.tar", DataType.URI, true, false, null);
- output1.setLocation("output");
- OutputDataObjectType output2 = createAppOutput("STDOUT", null, DataType.STDOUT, true, false, null);
- OutputDataObjectType output3 = createAppOutput("STDERR", null, DataType.STDERR, true, false, null);
- List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
- applicationOutputs.add(output1);
- applicationOutputs.add(output2);
- applicationOutputs.add(output3);
+ applicationDeployementListPerGateway.put(echoLocalAppDeployId, testGateway.getGatewayId());
- String ultrascanAppId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(),
- createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.ULTRASCAN, TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION,
- appModules, applicationInputs, applicationOutputs));
- System.out.println("Ultrascan Application Interface Id " + ultrascanAppId);
- return ultrascanAppId;
+ return new ApplicationProperties(localEchoModuleId, echoInterfaceId, echoLocalAppDeployId);
}
- private String registerAmberInterface(Gateway gateway, String amberModuleId) throws org.apache.thrift.TException {
- List<String> appModules = new ArrayList<String>();
- appModules.add(amberModuleId);
-
- InputDataObjectType input1 = createAppInput("heatRst", null,
- DataType.URI, "-c", 1, true, true,false, "Heating up the system equilibration stage - 02_Heat.rst", null);
-
- InputDataObjectType input2 = createAppInput("prodIn", null,
- DataType.URI, "-i ", 2, true, true, false, "Constant pressure and temperature for production stage - 03_Prod.in", null);
+ public ApplicationModule getApplicationModule(String applicationModuleId){
+ ApplicationModule applicationModule = null;
+ try {
+ applicationModule = airavata.getApplicationModule(authzToken, applicationModuleId);
+ } catch (TException e) {
+ logger.error("Error fetching application module", e);
+ }
+ return applicationModule;
+ }
- InputDataObjectType input3 = createAppInput("prmtop", null,
- DataType.URI, "-p", 3, true, true, false, "Parameter and Topology coordinates - prmtop", null);
+ public ApplicationInterfaceDescription getApplicationInterfaceDescription(String applicationInterfaceId){
+ ApplicationInterfaceDescription applicationInterfaceDescription = null;
+ try {
+ applicationInterfaceDescription = airavata.getApplicationInterface(authzToken, applicationInterfaceId);
+ } catch (TException e) {
+ logger.error("Error fetching application interface description", e);
+ }
+ return applicationInterfaceDescription;
+ }
- List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
- applicationInputs.add(input1);
- applicationInputs.add(input2);
- applicationInputs.add(input3);
-
- OutputDataObjectType output1 = createAppOutput("AMBER_Execution_Summary", "03_Prod.info", DataType.URI, true, true, "-inf");
- OutputDataObjectType output2 = createAppOutput("AMBER_Execution_log", "03_Prod.out", DataType.URI, true, true, "-o");
- OutputDataObjectType output3 = createAppOutput("AMBER_Trajectory_file", "03_Prod.mdcrd", DataType.URI, true, true, "-x");
- OutputDataObjectType output4 = createAppOutput("AMBER_Restart_file", "03_Prod.rst", DataType.URI, true, true, " -r");
- OutputDataObjectType output5 = createAppOutput("STDOUT", null, DataType.STDOUT, true, false, null);
- OutputDataObjectType output6 = createAppOutput("STDERR", null, DataType.STDERR, true, false, null);
- List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
- applicationOutputs.add(output1);
- applicationOutputs.add(output2);
- applicationOutputs.add(output3);
- applicationOutputs.add(output4);
- applicationOutputs.add(output5);
- applicationOutputs.add(output6);
- String amberInterfaceId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(),
- createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME, TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION,
- appModules, applicationInputs, applicationOutputs));
- System.out.println("Amber Application Interface Id " + amberInterfaceId);
- return amberInterfaceId;
+ public ApplicationDeploymentDescription getApplicationDeploymentDescription(String applicationDeployId){
+ ApplicationDeploymentDescription applicationDeploymentDescription = null;
+ try {
+ applicationDeploymentDescription = airavata.getApplicationDeployment(authzToken, applicationDeployId);
+ } catch (TException e) {
+ logger.error("Error fetching application deployment description", e);
+ }
+ return applicationDeploymentDescription;
}
- private String registerEchoInterface(Gateway gateway, String moduleId) throws org.apache.thrift.TException {
+ private String registerLocalEchoInterface(Gateway gateway, String moduleId) throws org.apache.thrift.TException {
List<String> appModules = new ArrayList<String>();
appModules.add(moduleId);
- InputDataObjectType input1 = createAppInput("input_to_Echo", null,
- DataType.STRING, null, 1, true, true,false, "Sample input to Echo", null);
+ InputDataObjectType input1 = createAppInput(INPUT_NAME, INPUT_VALUE,
+ DataType.STRING, null, 0, true, true,false, INPUT_DESC, null);
- List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
+ List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>(1);
applicationInputs.add(input1);
- OutputDataObjectType output1 = createAppOutput("STDOUT", null, DataType.STDOUT, true, false, null);
- OutputDataObjectType output2 = createAppOutput("STDERR", null, DataType.STDERR, true, false, null);
- List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
+ OutputDataObjectType output1 = createAppOutput(STDOUT_NAME, STDOUT_VALUE, DataType.URI, true, true, null);
+ OutputDataObjectType output2 = createAppOutput(STDERR_NAME, STDERR_VALUE, DataType.URI, true, true, null);
+
+ List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>(2);
applicationOutputs.add(output1);
applicationOutputs.add(output2);
- String echoInterfaceId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(),
- createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME, TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION,
+ String localEchoInterfaceId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(),
+ createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME, TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION,
appModules, applicationInputs, applicationOutputs));
- System.out.println("Echo Application Interface Id " + echoInterfaceId);
- return echoInterfaceId;
- }
-
-
- protected void addEchoApplication() throws Exception{
- for (Gateway gateway : allGateways){
- boolean isgatewayValid = true;
- for (String ovoidGateway : gatewaysToAvoid){
- if (gateway.getGatewayId().equals(ovoidGateway)){
- isgatewayValid = false;
- break;
- }
- }
- if (isgatewayValid) {
- // add echo module
- String echoModuleId = airavata.registerApplicationModule(authzToken, gateway.getGatewayId(),
- createApplicationModule(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME, "1.0", TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION));
- System.out.println("Echo Module Id " + echoModuleId);
-
- // add amber interface
- String echoInterfaceId = registerEchoInterface(gateway, echoModuleId);
- applicationInterfaceListPerGateway.put(echoInterfaceId, gateway.getGatewayId());
-
- // add amber deployment
- String echoStampedeAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(echoModuleId, stampedeResourceId,
- "/home1/01437/ogce/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL,
- TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, null, null, null));
-
- String echoTrestlesAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(echoModuleId, trestlesResourceId,
- "/home/ogce/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL,
- TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, null, null, null));
-
- String echoBr2AppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(),
- createApplicationDeployment(echoModuleId, br2ResourceId,
- "/N/u/cgateway/BigRed2/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL,
- TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, null, null, null));
-
- applicationDeployementListPerGateway.put(echoStampedeAppDeployId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(echoTrestlesAppDeployId, gateway.getGatewayId());
- applicationDeployementListPerGateway.put(echoBr2AppDeployId, gateway.getGatewayId());
- }
- }
- }
-
- protected void addLAMMPSApplication() throws Exception{
- // add LAMPPS module
- // add LAMPSS interface
- // add LAMPSS deployment
+ System.out.println("Echo Local Application Interface Id " + localEchoInterfaceId);
+ return localEchoInterfaceId;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ce359dc0/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
index 2e28e9e..429b1b9 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
@@ -27,22 +27,25 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePrefer
import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
import org.apache.airavata.model.data.movement.DMType;
import org.apache.airavata.model.data.movement.DataMovementProtocol;
-import org.apache.airavata.model.data.movement.SCPDataMovement;
+import org.apache.airavata.model.data.movement.LOCALDataMovement;
import org.apache.airavata.model.data.movement.SecurityProtocol;
import org.apache.airavata.model.error.AiravataClientException;
import org.apache.airavata.model.security.AuthzToken;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.ComputeResourceProperties;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.LocalEchoProperties.*;
+import static org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants.LocalEchoProperties.LocalEchoComputeResource.*;
+
public class ComputeResourceRegister {
private Airavata.Client airavata;
- private List<String> computeResourceIds;
private Map<String, String> loginNamesWithResourceMap;
private Map<String, String> loginNamesWithResourceIds;
private final static Logger logger = LoggerFactory.getLogger(ComputeResourceRegister.class);
@@ -52,7 +55,6 @@ public class ComputeResourceRegister {
public ComputeResourceRegister(Airavata.Client airavata, TestFrameworkProps props) throws Exception {
this.airavata = airavata;
this.properties = props;
- computeResourceIds = new ArrayList<String>();
loginNamesWithResourceMap = getLoginNamesMap();
authzToken = new AuthzToken("emptyToken");
@@ -80,61 +82,49 @@ public class ComputeResourceRegister {
return loginNamesWithResourceIds;
}
- public void addComputeResources () throws Exception {
- String stampedeResourceId = null;
- String trestlesResourceId = null;
- String bigredResourceId = null;
- String gordenResourceId = null;
- String alamoResourceId = null;
+ public ComputeResourceProperties addComputeResources () throws Exception {
+ ComputeResourceProperties computeResourceProperties = null;
try {
+// Map<String, String> computeResources = airavata.getAllComputeResourceNames(authzToken);
+// for(Map.Entry<String, String> computeResource: computeResources.entrySet()){
+// if(computeResource.getValue().contains("localhost")){
+// localResourceId = computeResource.getKey();
+// System.out.println("Existing Local Resource Id " + localResourceId);
+// return localResourceId;
+// }
+// }
+
for (String resourceName : loginNamesWithResourceMap.keySet()) {
- if (resourceName.contains("stampede")) {
- // adding stampede
- stampedeResourceId = registerComputeHost(resourceName, "TACC Stampede Cluster",
- ResourceJobManagerType.SLURM, "push", "/usr/bin", SecurityProtocol.SSH_KEYS, 22, "ibrun");
- System.out.println("Stampede Resource Id is " + stampedeResourceId);
- } else if (resourceName.contains("trestles")) {
- //Register Trestles
- trestlesResourceId = registerComputeHost("trestles.sdsc.xsede.org", "SDSC Trestles Cluster",
- ResourceJobManagerType.PBS, "push", "/opt/torque/bin/", SecurityProtocol.SSH_KEYS, 22, "mpirun -np");
- System.out.println("Trestles Resource Id is " + trestlesResourceId);
- } else if (resourceName.contains("bigred2")) {
- //Register BigRedII
- bigredResourceId = registerComputeHost("bigred2.uits.iu.edu", "IU BigRed II Cluster",
- ResourceJobManagerType.PBS, "push", "/opt/torque/torque-5.0.1/bin/", SecurityProtocol.SSH_KEYS, 22, "aprun -n");
- System.out.println("BigredII Resource Id is " + bigredResourceId);
- } else if (resourceName.contains("gordon")) {
- //Register BigRedII
- gordenResourceId = registerComputeHost("gordon.sdsc.edu", "SDSC Gorden Cluster",
- ResourceJobManagerType.PBS, "push", "/opt/torque/bin/", SecurityProtocol.SSH_KEYS, 22, "mpirun_rsh -hostfile $PBS_NODEFILE -np");
- System.out.println("BigredII Resource Id is " + bigredResourceId);
- } else if (resourceName.contains("alamo")) {
- //Register BigRedII
- alamoResourceId = registerComputeHost("alamo.uthscsa.edu", "TACC alamo Cluster",
- ResourceJobManagerType.PBS, "push", "/usr/bin/", SecurityProtocol.SSH_KEYS, 22, " /usr/bin/mpiexec -np");
- System.out.println("BigredII Resource Id is " + bigredResourceId);
+ if (resourceName.contains(RESOURCE_NAME)) {
+ computeResourceProperties = registerComputeHost(HOST_NAME, HOST_DESC,
+ ResourceJobManagerType.FORK, null, "", SecurityProtocol.LOCAL, TestFrameworkConstants.LocalEchoProperties.LocalEchoComputeResource.JOB_MANAGER_COMMAND);
+ System.out.println("Local Resource Id " + computeResourceProperties.getComputeResourceId());
}
}
- computeResourceIds.add(stampedeResourceId);
- computeResourceIds.add(trestlesResourceId);
- computeResourceIds.add(bigredResourceId);
- computeResourceIds.add(gordenResourceId);
- computeResourceIds.add(alamoResourceId);
+
}catch (Exception e) {
logger.error("Error occured while adding compute resources", e);
throw new Exception("Error occured while adding compute resources", e);
}
+ return computeResourceProperties;
+ }
+
+ public ComputeResourceDescription getComputeResource(String computeResourceId) throws Exception {
+ return airavata.getComputeResource(authzToken, computeResourceId);
}
- public String registerComputeHost(String hostName, String hostDesc,
- ResourceJobManagerType resourceJobManagerType,
- String monitoringEndPoint, String jobMangerBinPath,
- SecurityProtocol securityProtocol, int portNumber, String jobManagerCommand) throws TException {
+ public ComputeResourceProperties registerComputeHost(String hostName, String hostDesc,
+ ResourceJobManagerType resourceJobManagerType,
+ String monitoringEndPoint, String jobMangerBinPath,
+ SecurityProtocol securityProtocol, String jobManagerCommand) throws TException {
ComputeResourceDescription computeResourceDescription = createComputeResourceDescription(hostName, hostDesc, null, null);
+ ComputeResourceProperties computeResourceProperties = new ComputeResourceProperties();
+
String computeResourceId = airavata.registerComputeResource(authzToken, computeResourceDescription);
+ computeResourceProperties.setComputeResourceId(computeResourceId);
if (computeResourceId.isEmpty()) throw new AiravataClientException();
@@ -146,19 +136,21 @@ public class ComputeResourceRegister {
resourceJobManager.setJobManagerCommands(jobManagerCommandStringMap);
}
- SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
- sshJobSubmission.setResourceJobManager(resourceJobManager);
- sshJobSubmission.setSecurityProtocol(securityProtocol);
-// sshJobSubmission.setMonitorMode(MonitorMode.JOB_EMAIL_NOTIFICATION_MONITOR);
- sshJobSubmission.setSshPort(portNumber);
- airavata.addSSHJobSubmissionDetails(authzToken, computeResourceId, 1, sshJobSubmission);
+ LOCALSubmission localobSubmission = new LOCALSubmission();
+ localobSubmission.setResourceJobManager(resourceJobManager);
+ localobSubmission.setSecurityProtocol(securityProtocol);
+
+ String localJobSubmissionId = airavata.addLocalSubmissionDetails(authzToken, computeResourceId, 0, localobSubmission);
+ computeResourceProperties.setJobSubmissionId(localJobSubmissionId);
+
+ airavata.addLocalDataMovementDetails(authzToken, computeResourceId, DMType.COMPUTE_RESOURCE, 0, new LOCALDataMovement());
+
+ return computeResourceProperties;
+ }
- SCPDataMovement scpDataMovement = new SCPDataMovement();
- scpDataMovement.setSecurityProtocol(securityProtocol);
- scpDataMovement.setSshPort(portNumber);
- airavata.addSCPDataMovementDetails(authzToken, computeResourceId, DMType.COMPUTE_RESOURCE, 1, scpDataMovement);
+ public LOCALSubmission getLocalSubmission(String jobSubmissionId) throws Exception {
+ return airavata.getLocalJobSubmission(authzToken, jobSubmissionId);
- return computeResourceId;
}
public ComputeResourceDescription createComputeResourceDescription(
@@ -168,6 +160,7 @@ public class ComputeResourceRegister {
host.setResourceDescription(hostDesc);
host.setIpAddresses(ipAddresses);
host.setHostAliases(hostAliases);
+ host.setEnabled(true);
return host;
}
@@ -182,54 +175,20 @@ public class ComputeResourceRegister {
return resourceJobManager;
}
- public void registerGatewayResourceProfile() throws Exception{
+ public void registerGatewayResourceProfile(String computeResourceId) throws Exception{
try {
- ComputeResourcePreference stampedeOGCEResourcePreferences = null;
- ComputeResourcePreference stampedeUS3ResourcePreferences = null;
- ComputeResourcePreference trestlesOGCEResourcePreferences = null;
- ComputeResourcePreference trestlesUS3ResourcePreferences = null;
- ComputeResourcePreference bigRedCgatewayResourcePreferences = null;
- ComputeResourcePreference gordenUS3ResourcePreference = null;
- ComputeResourcePreference alamoUS3ResourcePreference = null;
+ ComputeResourcePreference localResourcePreference = null;
loginNamesWithResourceIds = getLoginNamesWithResourceIDs();
-
List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayResourceProfiles(authzToken);
for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources) {
for (String resourceId : loginNamesWithResourceIds.keySet()) {
String loginUserName = loginNamesWithResourceIds.get(resourceId);
- if (resourceId.contains("stampede") ) {
- if (loginUserName.equals("ogce")){
- stampedeOGCEResourcePreferences = createComputeResourcePreference(resourceId, "TG-STA110014S", false, null,
- JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/scratch/01437/ogce/gta-work-dirs", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, stampedeOGCEResourcePreferences);
- }else if (loginUserName.equals("us3")){
- stampedeUS3ResourcePreferences = createComputeResourcePreference(resourceId, "TG-MCB070039N", false, null,
- JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/scratch/01623/us3/jobs/", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, stampedeUS3ResourcePreferences);
- }
- }else if (resourceId.contains("trestles")){
- if (loginUserName.equals("ogce")){
- trestlesOGCEResourcePreferences = createComputeResourcePreference(resourceId, "sds128", false, null, JobSubmissionProtocol.SSH,
- DataMovementProtocol.SCP, "/oasis/scratch/trestles/ogce/temp_project/gta-work-dirs", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, trestlesOGCEResourcePreferences);
- }else if (loginUserName.equals("us3")){
- trestlesUS3ResourcePreferences = createComputeResourcePreference(resourceId, "uot111", false, null, JobSubmissionProtocol.SSH,
- DataMovementProtocol.SCP, "/oasis/projects/nsf/uot111/us3/airavata-workdirs/", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, trestlesUS3ResourcePreferences);
- }
- }else if (resourceId.contains("bigred2") && loginUserName.equals("cgateway")){
- bigRedCgatewayResourcePreferences = createComputeResourcePreference(resourceId, "TG-STA110014S", false, null, null, null,
- "/N/dc2/scratch/cgateway/gta-work-dirs", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, bigRedCgatewayResourcePreferences);
- }else if (resourceId.contains("gordon") && loginUserName.equals("us3")){
- gordenUS3ResourcePreference = createComputeResourcePreference(resourceId, "uot111", false, null, JobSubmissionProtocol.SSH,
- DataMovementProtocol.SCP, "/home/us3/gordon/work/airavata", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, gordenUS3ResourcePreference);
- }else if (resourceId.contains("alamo") && loginUserName.equals("us3")){
- alamoUS3ResourcePreference = createComputeResourcePreference(resourceId, null, false, "batch", JobSubmissionProtocol.SSH,
- DataMovementProtocol.SCP, "/home/us3/work/airavata", loginUserName);
- airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, alamoUS3ResourcePreference);
+ if (resourceId.equals(computeResourceId) && loginUserName.equals(LOGIN_USER)){
+ localResourcePreference = createComputeResourcePreference(resourceId, ALLOCATION_PROJECT_NUMBER, true, BATCH_QUEUE, JobSubmissionProtocol.LOCAL,
+ DataMovementProtocol.LOCAL, TestFrameworkConstants.SCRATCH_LOCATION, loginUserName);
+ airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, localResourcePreference);
+
}
}
}
@@ -239,6 +198,10 @@ public class ComputeResourceRegister {
}
}
+ public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayId, String computeResourceId) throws Exception{
+ return airavata.getGatewayComputeResourcePreference(authzToken, gatewayId, computeResourceId);
+ }
+
public ComputeResourcePreference createComputeResourcePreference(String computeResourceId, String allocationProjectNumber,
boolean overridebyAiravata, String preferredBatchQueue,
JobSubmissionProtocol preferredJobSubmissionProtocol,
@@ -256,12 +219,4 @@ public class ComputeResourceRegister {
computeResourcePreference.setLoginUserName(loginUserName);
return computeResourcePreference;
}
-
- public List<String> getComputeResourceIds() {
- return computeResourceIds;
- }
-
- public void setComputeResourceIds(List<String> computeResourceIds) {
- this.computeResourceIds = computeResourceIds;
- }
}