You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/04/03 17:24:41 UTC

[01/11] airavata git commit: adding app catalog related functions - AIRAVATA-1652

Repository: airavata
Updated Branches:
  refs/heads/emailMonitoring fb6e3b6e9 -> b368cb088


adding app catalog related functions - AIRAVATA-1652


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/aff5d928
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/aff5d928
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/aff5d928

Branch: refs/heads/emailMonitoring
Commit: aff5d9288dfccd6b5d7dd8e22dd1f7d6e1c67b48
Parents: 17b8740
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Mon Mar 30 13:56:16 2015 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Mon Mar 30 13:56:16 2015 -0400

----------------------------------------------------------------------
 .../ApplicationRegister.java                    | 301 +++++++++++++++++++
 .../ComputeResourceRegister.java                | 157 ++++++++--
 .../utils/TestFrameworkConstants.java           |  27 ++
 .../main/resources/test-framework.properties    |   9 +-
 4 files changed, 469 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/aff5d928/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 56a9633..b11e572 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
@@ -21,5 +21,306 @@
 
 package org.apache.airavata.testsuite.multitenantedairavata;
 
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.DataType;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class ApplicationRegister {
+    private Airavata.Client airavata;
+    private List<Gateway> allGateways;
+    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;
+
+
+    public ApplicationRegister(Airavata.Client airavata) throws Exception {
+        this.airavata = airavata;
+        allGateways = getAllGateways(airavata);
+        applicationInterfaceListPerGateway = new HashMap<String, String>();
+        applicationDeployementListPerGateway = new HashMap<String, String>();
+        Map<String, String> allComputeResourceNames = airavata.getAllComputeResourceNames();
+        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.TRESTLES_RESOURCE_NAME)){
+                trestlesResourceId = resourceId;
+            }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)){
+                br2ResourceId = resourceId;
+            }
+        }
+    }
+
+    public List<Gateway> getAllGateways(Airavata.Client client) throws Exception{
+        try {
+             return client.getAllGateways();
+        }catch (Exception e){
+            logger.error("Error while getting all the gateways", e);
+            throw new Exception("Error while getting all the gateways", e);
+        }
+    }
+
+
+
+    public void addApplications () throws Exception{
+        addAmberApplication();
+        addEchoApplication();
+        addLAMMPSApplication();
+    }
+
+    public void addAmberApplication () throws Exception{
+        for (Gateway gateway : allGateways){
+            // add amber module
+            String amberModuleId = airavata.registerApplicationModule(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<String> moduleLoadCMDs = new ArrayList<String>();
+            moduleLoadCMDs.add("module load amber");
+            String amberStampedeAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(),
+                    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 amberTrestlesAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(),
+                    createApplicationDeployment(amberModuleId, trestlesResourceId,
+                            "/opt/amber/bin/sander.MPI -O", ApplicationParallelismType.MPI,
+                            TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, moduleLoadCMDs, null, null));
+
+            List<String> amberModuleLoadCMDsBr2 = new ArrayList<String>();
+            amberModuleLoadCMDsBr2.add("module load amber/gnu/mpi/12");
+            amberModuleLoadCMDsBr2.add("module swap PrgEnv-cray PrgEnv-gnu");
+            String amberBr2AppDeployId = airavata.registerApplicationDeployment(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());
+        }
+
+    }
+
+    private String registerAmberInterface(Gateway gateway, String amberModuleId) throws org.apache.thrift.TException {
+        List<String> appModules = new ArrayList<String>();
+        appModules.add(amberModuleId);
+
+        InputDataObjectType input1 = createAppInput("Heat_Restart_File", null,
+                DataType.URI, null, 1, true, true,false, "Heating up the system equilibration stage - 02_Heat.rst", null);
+
+        InputDataObjectType input2 = createAppInput("Production_Control_File", null,
+                DataType.URI, null, 2, true, true, false, "Constant pressure and temperature for production stage - 03_Prod.in", null);
+
+        InputDataObjectType input3 = createAppInput("Parameter_Topology_File", null,
+                DataType.URI, null, 3, true, true, false, "Parameter and Topology coordinates - prmtop", null);
+
+        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);
+        OutputDataObjectType output2 = createAppOutput("AMBER_Execution_log", "03_Prod.out", DataType.URI, true, true);
+        OutputDataObjectType output3 = createAppOutput("AMBER_Trajectory_file", "03_Prod.mdcrd", DataType.URI, true, true);
+        OutputDataObjectType output4 = createAppOutput("AMBER_Restart_file", "03_Prod.rst", DataType.URI, true, true);
+        OutputDataObjectType output5 = createAppOutput("STDOUT", null, DataType.STDOUT, true, false);
+        OutputDataObjectType output6 = createAppOutput("STDERR", null, DataType.STDERR, true, false);
+        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(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;
+    }
+
+    private String registerEchoInterface(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);
+
+        List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
+        applicationInputs.add(input1);
+
+        OutputDataObjectType output1 = createAppOutput("STDOUT", null, DataType.STDOUT, true, false);
+        OutputDataObjectType output2 = createAppOutput("STDERR", null, DataType.STDERR, true, false);
+        List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
+        applicationOutputs.add(output1);
+        applicationOutputs.add(output2);
+
+        String echoInterfaceId = airavata.registerApplicationInterface(gateway.getGatewayId(),
+                createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME, TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION,
+                        appModules, applicationInputs, applicationOutputs));
+        System.out.println("Echo Application Interface Id " + echoInterfaceId);
+        return echoInterfaceId;
+    }
+
+
+    public void addEchoApplication() throws Exception{
+        for (Gateway gateway : allGateways){
+            // add echo module
+            String echoModuleId = airavata.registerApplicationModule(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(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(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(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());
+        }
+    }
+
+    public void addLAMMPSApplication() throws Exception{
+        // add LAMPPS module
+        // add LAMPSS interface
+        // add LAMPSS deployment
+    }
+
+
+    public static ApplicationDeploymentDescription createApplicationDeployment(String appModuleId,
+                                                                               String computeResourceId,
+                                                                               String executablePath,
+                                                                               ApplicationParallelismType parallelism,
+                                                                               String appDeploymentDescription,
+                                                                               List<String> moduleLoadCmds,
+                                                                               List<String> preJobCmds,
+                                                                               List<String> postJobCmds) {
+        ApplicationDeploymentDescription deployment = new ApplicationDeploymentDescription();
+        deployment.setAppDeploymentDescription(appDeploymentDescription);
+        deployment.setAppModuleId(appModuleId);
+        deployment.setComputeHostId(computeResourceId);
+        deployment.setExecutablePath(executablePath);
+        deployment.setParallelism(parallelism);
+        deployment.setModuleLoadCmds(moduleLoadCmds);
+        deployment.setPreJobCommands(preJobCmds);
+        deployment.setPostJobCommands(postJobCmds);
+        return deployment;
+    }
+
+    public static ApplicationModule createApplicationModule(String appModuleName,
+                                                            String appModuleVersion, String appModuleDescription) {
+        ApplicationModule module = new ApplicationModule();
+        module.setAppModuleDescription(appModuleDescription);
+        module.setAppModuleName(appModuleName);
+        module.setAppModuleVersion(appModuleVersion);
+        return module;
+    }
+
+    public static InputDataObjectType createAppInput (String inputName,
+                                                      String value,
+                                                      DataType type,
+                                                      String applicationArgument,
+                                                      int order,
+                                                      boolean isRequired,
+                                                      boolean requiredToCMD,
+                                                      boolean stdIn,
+                                                      String description,
+                                                      String metadata) {
+        InputDataObjectType input = new InputDataObjectType();
+        if (inputName != null) input.setName(inputName);
+        if (value != null) input.setValue(value);
+        if (type != null) input.setType(type);
+        if (applicationArgument != null) input.setApplicationArgument(applicationArgument);
+        input.setInputOrder(order);
+        input.setIsRequired(isRequired);
+        input.setRequiredToAddedToCommandLine(requiredToCMD);
+        if (description != null) input.setUserFriendlyDescription(description);
+        input.setStandardInput(stdIn);
+        if (metadata != null) input.setMetaData(metadata);
+        return input;
+    }
+
+    public static OutputDataObjectType createAppOutput(String inputName,
+                                                       String value,
+                                                       DataType type,
+                                                       boolean isRequired,
+                                                       boolean requiredToCMD) {
+        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+        if (inputName != null) outputDataObjectType.setName(inputName);
+        if (value != null) outputDataObjectType.setValue(value);
+        if (type != null) outputDataObjectType.setType(type);
+        outputDataObjectType.setIsRequired(isRequired);
+        outputDataObjectType.setRequiredToAddedToCommandLine(requiredToCMD);
+        return outputDataObjectType;
+    }
+
+    public static ApplicationInterfaceDescription createApplicationInterfaceDescription
+            (String applicationName, String applicationDescription, List<String> applicationModules,
+             List<InputDataObjectType> applicationInputs, List<OutputDataObjectType>applicationOutputs) {
+        ApplicationInterfaceDescription applicationInterfaceDescription = new ApplicationInterfaceDescription();
+
+        applicationInterfaceDescription.setApplicationName(applicationName);
+        if (applicationDescription != null) applicationInterfaceDescription.setApplicationDescription(applicationDescription);
+        if (applicationModules != null) applicationInterfaceDescription.setApplicationModules(applicationModules);
+        if (applicationInputs != null) applicationInterfaceDescription.setApplicationInputs(applicationInputs);
+        if (applicationOutputs != null) applicationInterfaceDescription.setApplicationOutputs(applicationOutputs);
+
+        return applicationInterfaceDescription;
+    }
+
+    public Map<String, String> getApplicationInterfaceListPerGateway() {
+        return applicationInterfaceListPerGateway;
+    }
+
+    public void setApplicationInterfaceListPerGateway(Map<String, String> applicationInterfaceListPerGateway) {
+        this.applicationInterfaceListPerGateway = applicationInterfaceListPerGateway;
+    }
+
+    public Map<String, String> getApplicationDeployementListPerGateway() {
+        return applicationDeployementListPerGateway;
+    }
+
+    public void setApplicationDeployementListPerGateway(Map<String, String> applicationDeployementListPerGateway) {
+        this.applicationDeployementListPerGateway = applicationDeployementListPerGateway;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/aff5d928/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 af1c779..9127fc9 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
@@ -23,42 +23,92 @@ package org.apache.airavata.testsuite.multitenantedairavata;
 
 import org.apache.airavata.api.Airavata;
 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.error.AiravataClientException;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader;
+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 java.util.*;
 
 public class ComputeResourceRegister {
     private Airavata.Client airavata;
     private List<String> computeResourceIds;
+    private PropertyReader propertyReader;
+    private Map<String, String> loginNamesWithResourceMap;
+    private final static Logger logger = LoggerFactory.getLogger(ComputeResourceRegister.class);
 
-    public ComputeResourceRegister(Airavata.Client airavata) {
+    public ComputeResourceRegister(Airavata.Client airavata) throws Exception {
         this.airavata = airavata;
         computeResourceIds = new ArrayList<String>();
+        propertyReader = new PropertyReader();
+        loginNamesWithResourceMap = getLoginNamesMap();
+
     }
 
-    public void addComputeResources () throws TException {
-        // adding stampede
-        String stampedeResourceId = registerComputeHost("stampede.tacc.xsede.org", "TACC Stampede Cluster",
-                ResourceJobManagerType.SLURM, "push", "/usr/bin", SecurityProtocol.SSH_KEYS, 22, null);
-        System.out.println("Stampede Resource Id is " + stampedeResourceId);
-
-        //Register Trestles
-        String trestlesResourceId = registerComputeHost("trestles.sdsc.xsede.org", "SDSC Trestles Cluster",
-                ResourceJobManagerType.PBS, "push", "/opt/torque/bin/", SecurityProtocol.SSH_KEYS, 22, null);
-        System.out.println("Trestles Resource Id is " + trestlesResourceId);
-
-        //Register BigRedII
-        String bigredResourceId = registerComputeHost("bigred2.uits.iu.edu", "IU BigRed II Cluster",
-                ResourceJobManagerType.PBS, "push", "/opt/torque/torque-4.2.3.1/bin/", SecurityProtocol.SSH_KEYS, 22, "aprun -n");
-        System.out.println("BigredII Resource Id is " + bigredResourceId);
-
-        computeResourceIds.add(stampedeResourceId);
-        computeResourceIds.add(trestlesResourceId);
-        computeResourceIds.add(bigredResourceId);
+    public Map<String, String> getLoginNamesMap() throws Exception {
+        loginNamesWithResourceMap = new HashMap<String, String>();
+        List<String> loginNameList = new ArrayList<String>();
+        List<String> computerResources = new ArrayList<String>();
+        String loginNames = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.LOGIN_USERNAME_LIST, PropertyFileType.TEST_FRAMEWORK);
+        if (loginNames != null && !loginNames.isEmpty()){
+            String[] names = loginNames.split(",");
+            loginNameList = Arrays.asList(names);
+        }
+        String clist = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.COMPUTE_RESOURCE_LIST, PropertyFileType.TEST_FRAMEWORK);
+        if (clist != null && !clist.isEmpty()) {
+            String[] resources = clist.split(",");
+            computerResources = Arrays.asList(resources);
+        }
+
+        if (computerResources.size() == loginNameList.size()){
+            for (int i=0; i < computerResources.size(); i++){
+                loginNamesWithResourceMap.put(computerResources.get(i), loginNameList.get(i));
+            }
+        }else {
+           logger.error("Each compute resource should have a login user name. Please check whether you specified them correctly " +
+                   "in test-framework.properties files..");
+            throw new Exception("Each compute resource should have a login user name. Please check whether you specified them correctly " +
+                    "in test-framework.properties files..");
+        }
+        return loginNamesWithResourceMap;
+    }
+
+    public void addComputeResources () throws Exception {
+        String stampedeResourceId = null;
+        String trestlesResourceId = null;
+        String bigredResourceId = null;
+        try {
+            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, null);
+                    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, null);
+                    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-4.2.3.1/bin/", SecurityProtocol.SSH_KEYS, 22, "aprun -n");
+                    System.out.println("BigredII Resource Id is " + bigredResourceId);
+                }
+            }
+            computeResourceIds.add(stampedeResourceId);
+            computeResourceIds.add(trestlesResourceId);
+            computeResourceIds.add(bigredResourceId);
+        }catch (Exception e) {
+            logger.error("Error occured while adding compute resources", e);
+            throw new Exception("Error occured while adding compute resources", e);
+        }
+
     }
 
     public String registerComputeHost(String hostName, String hostDesc,
@@ -114,4 +164,63 @@ public class ComputeResourceRegister {
         resourceJobManager.setJobManagerCommands(jobManagerCommands);
         return resourceJobManager;
     }
+
+    public void registerGatewayResourceProfile() throws Exception{
+        try {
+            ComputeResourcePreference stampedeResourcePreferences = null;
+            ComputeResourcePreference trestlesResourcePreferences = null;
+            ComputeResourcePreference bigRedResourcePreferences = null;
+
+            for (String resourceName : loginNamesWithResourceMap.keySet()) {
+                if (resourceName.contains("stampede")) {
+                    stampedeResourcePreferences = createComputeResourcePreference(resourceName, "TG-STA110014S", false, null,
+                            JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/scratch/01437/ogce/gta-work-dirs", loginNamesWithResourceMap.get(resourceName));
+                }else if (resourceName.contains("trestles")){
+                    trestlesResourcePreferences = createComputeResourcePreference(resourceName, "sds128", false, null, JobSubmissionProtocol.SSH,
+                            DataMovementProtocol.SCP, "/oasis/scratch/trestles/ogce/temp_project/gta-work-dirs", loginNamesWithResourceMap.get(resourceName));
+                }else if (resourceName.contains("bigred2")){
+                    bigRedResourcePreferences = createComputeResourcePreference(resourceName, "TG-STA110014S", false, null, null, null,
+                            "/N/dc2/scratch/cgateway/gta-work-dirs", loginNamesWithResourceMap.get(resourceName));
+                }
+            }
+
+            List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayComputeResources();
+            for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources){
+                gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
+                gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
+                gatewayResourceProfile.addToComputeResourcePreferences(bigRedResourcePreferences);
+                airavata.updateGatewayResourceProfile(gatewayResourceProfile.getGatewayID(), gatewayResourceProfile);
+            }
+        } catch (TException e) {
+            logger.error("Error occured while updating gateway resource profiles", e);
+            throw new Exception("Error occured while updating gateway resource profiles", e);
+        }
+    }
+
+    public static ComputeResourcePreference
+    createComputeResourcePreference(String computeResourceId, String allocationProjectNumber,
+                                    boolean overridebyAiravata, String preferredBatchQueue,
+                                    JobSubmissionProtocol preferredJobSubmissionProtocol,
+                                    DataMovementProtocol preferredDataMovementProtocol,
+                                    String scratchLocation,
+                                    String loginUserName) {
+        ComputeResourcePreference computeResourcePreference = new ComputeResourcePreference();
+        computeResourcePreference.setComputeResourceId(computeResourceId);
+        computeResourcePreference.setOverridebyAiravata(overridebyAiravata);
+        computeResourcePreference.setAllocationProjectNumber(allocationProjectNumber);
+        computeResourcePreference.setPreferredBatchQueue(preferredBatchQueue);
+        computeResourcePreference.setPreferredDataMovementProtocol(preferredDataMovementProtocol);
+        computeResourcePreference.setPreferredJobSubmissionProtocol(preferredJobSubmissionProtocol);
+        computeResourcePreference.setScratchLocation(scratchLocation);
+        computeResourcePreference.setLoginUserName(loginUserName);
+        return computeResourcePreference;
+    }
+
+    public List<String> getComputeResourceIds() {
+        return computeResourceIds;
+    }
+
+    public void setComputeResourceIds(List<String> computeResourceIds) {
+        this.computeResourceIds = computeResourceIds;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/aff5d928/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
index 557f95c..c4bf8e4 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
@@ -53,7 +53,34 @@ public class TestFrameworkConstants {
 
     public static final class AppcatalogConstants {
         public static final String AMBER_APP_NAME = "amber_sander";
+        public static final String ECHO_NAME = "Echo";
+        public static final String ESPRESSO_NAME = "ESPRESSO";
+        public static final String GROMACS_NAME = "GROMACS";
+        public static final String LAMMPS_NAME = "LAMMPS";
+        public static final String NWCHEM_NAME = "NWChem";
+        public static final String TRINITY_NAME = "Trinity";
+        public static final String WRF_NAME = "WRF";
+        public static final String PHASTA_NAME = "PHASTA";
+        public static final String TINKER_MONTE_NAME = "TinkerMonte";
+        public static final String GAUSSIAN_NAME = "Gaussian";
+        public static final String GAMESS_NAME = "Gamess";
 
+        public static final String ECHO_DESCRIPTION = "A Simple Echo Application";
+        public static final String AMBER_DESCRIPTION = "Assisted Model Building with Energy Refinement MD Package";
+        public static final String ESPRESSO_DESCRIPTION = "Nanoscale electronic-structure calculations and materials modeling";
+        public static final String GROMACS_DESCRIPTION = "GROMACS Molecular Dynamics Package";
+        public static final String LAMMPS_DESCRIPTION = "Large-scale Atomic/Molecular Massively Parallel Simulator";
+        public static final String NWCHEM_DESCRIPTION = "Ab initio computational chemistry software package";
+        public static final String TRINITY_DESCRPTION = "de novo reconstruction of transcriptomes from RNA-seq data";
+        public static final String WRF_DESCRIPTION = "Weather Research and Forecasting";
+        public static final String PHASTA_DESCRIPTION = "Computational fluid dynamics solver";
+        public static final String TINKER_MONTE_DESCRIPTION = "Grid Chem Tinker Monte Application";
+        public static final String GAUSSIAN_DESCRIPTION = "Grid Chem Gaussian Application";
+        public static final String GAMESS_DESCRIPTION = "A Gamess Application";
+
+        public static final String STAMPEDE_RESOURCE_NAME = "stampede.tacc.xsede.org";
+        public static final String TRESTLES_RESOURCE_NAME = "trestles.sdsc.xsede.org";
+        public static final String BR2_RESOURCE_NAME = "bigred2.uits.iu.edu";
     }
 
     public static final class CredentialStoreConstants {

http://git-wip-us.apache.org/repos/asf/airavata/blob/aff5d928/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.properties
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.properties b/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.properties
index e7056ac..fe83905 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.properties
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.properties
@@ -21,7 +21,7 @@
 # Test environment related properties
 numberof.gateways=10
 users.per.gateway=10
-compute.resoure.list=trestles,stampede,br2
+compute.resoure.list=trestles.sdsc.xsede.org,stampede.tacc.xsede.org,bigred2.uits.iu.edu
 login.usernames=ogce,ogce,cgateway
 application.list=amber_sander,echo
 ssh.pub.key.location=ssh_key_location
@@ -29,3 +29,10 @@ ssh.private.key.location=ssh_key_location
 ssh.password=pwd
 ssh.username=username
 
+# Application Inputs
+# Amber input file locations
+02_Heat.rst_location=/a/b/c/02_Heat.rst
+03_Prod.in_location=/a/b/c/03_Prod.in
+prmtop_location=/a/b/c/prmtop
+
+


[04/11] airavata git commit: experiment execution for AIRAVATA-1652

Posted by sh...@apache.org.
experiment execution for AIRAVATA-1652


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/7812dcaf
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/7812dcaf
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/7812dcaf

Branch: refs/heads/emailMonitoring
Commit: 7812dcaf004d510e532e448a6053e8976ddc7154
Parents: d892369
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Mar 31 15:24:31 2015 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Mar 31 15:24:31 2015 -0400

----------------------------------------------------------------------
 .../test-suite/multi-tenanted-airavata/pom.xml  |  10 +
 .../ApplicationRegister.java                    |   2 -
 .../ExperimentExecution.java                    | 325 +++++++++++++++++++
 .../testsuite/multitenantedairavata/Setup.java  |   2 +-
 .../utils/TestFrameworkConstants.java           |  10 +
 .../main/resources/airavata-client.properties   |   7 +
 6 files changed, 353 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/7812dcaf/modules/test-suite/multi-tenanted-airavata/pom.xml
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/pom.xml b/modules/test-suite/multi-tenanted-airavata/pom.xml
index 21e157c..f974c59 100644
--- a/modules/test-suite/multi-tenanted-airavata/pom.xml
+++ b/modules/test-suite/multi-tenanted-airavata/pom.xml
@@ -51,6 +51,16 @@
         </dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-model-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-messaging-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-data-models</artifactId>
             <version>${project.version}</version>
         </dependency>

http://git-wip-us.apache.org/repos/asf/airavata/blob/7812dcaf/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 b11e572..8e71958 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
@@ -77,8 +77,6 @@ public class ApplicationRegister {
         }
     }
 
-
-
     public void addApplications () throws Exception{
         addAmberApplication();
         addEchoApplication();

http://git-wip-us.apache.org/repos/asf/airavata/blob/7812dcaf/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
new file mode 100644
index 0000000..b6b5476
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
@@ -0,0 +1,325 @@
+/*
+ *
+ * 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.api.Airavata;
+import org.apache.airavata.common.utils.ThriftUtils;
+import org.apache.airavata.messaging.core.MessageContext;
+import org.apache.airavata.messaging.core.MessageHandler;
+import org.apache.airavata.messaging.core.MessagingConstants;
+import org.apache.airavata.messaging.core.impl.RabbitMQStatusConsumer;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent;
+import org.apache.airavata.model.messaging.event.JobStatusChangeEvent;
+import org.apache.airavata.model.messaging.event.MessageType;
+import org.apache.airavata.model.util.ExperimentModelUtil;
+import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
+import org.apache.thrift.TBase;
+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;
+
+public class ExperimentExecution {
+    private Airavata.Client airavata;
+    private final static Logger logger = LoggerFactory.getLogger(ExperimentExecution.class);
+    private Map<String, String> experimentsWithTokens;
+    private Map<String, String> experimentsWithGateway;
+    private Map<String, String> csTokens;
+    private Map<String, String> appInterfaceMap;
+    private Map<String, String> projectsMap;
+    private PropertyReader propertyReader;
+
+    public ExperimentExecution(Airavata.Client airavata,
+                               Map<String, String> tokenMap,
+                               Map<String, String> appInterfaces,
+                               Map<String, String> projectMap ) {
+        this.airavata = airavata;
+        this.csTokens = tokenMap;
+        this.appInterfaceMap = appInterfaces;
+        this.propertyReader = new PropertyReader();
+        this.projectsMap = projectMap;
+        this.experimentsWithTokens = new HashMap<String, String>();
+        this.experimentsWithGateway = new HashMap<String, String>();
+    }
+
+    public void launchExperiments () throws Exception {
+        try {
+            for (String expId : experimentsWithTokens.keySet()){
+                airavata.launchExperiment(expId, experimentsWithTokens.get(expId));
+            }
+        }catch (Exception e){
+            logger.error("Error while launching experiment", e);
+            throw new Exception("Error while launching experiment", e);
+        }
+    }
+
+    public void monitorExperiments () throws Exception {
+        String brokerUrl = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.RABBIT_BROKER_URL, PropertyFileType.AIRAVATA_CLIENT);
+        System.out.println("broker url " + brokerUrl);
+        final String exchangeName = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.RABBIT_EXCHANGE_NAME, PropertyFileType.AIRAVATA_CLIENT);
+        RabbitMQStatusConsumer consumer = new RabbitMQStatusConsumer(brokerUrl, exchangeName);
+        for (final String expId : experimentsWithGateway.keySet()){
+            final String gatewayId = experimentsWithGateway.get(expId);
+            consumer.listen(new MessageHandler() {
+                @Override
+                public Map<String, Object> getProperties() {
+                    Map<String, Object> props = new HashMap<String, Object>();
+                    List<String> routingKeys = new ArrayList<String>();
+                    routingKeys.add(gatewayId);
+                    routingKeys.add(gatewayId + "." + expId);
+                    routingKeys.add(gatewayId + "." + expId + ".*");
+                    routingKeys.add(gatewayId + "." + expId + ".*.*");
+                    routingKeys.add(gatewayId + "." + expId + ".*.*.*");
+
+                    props.put(MessagingConstants.RABBIT_ROUTING_KEY, routingKeys);
+                    return props;
+                }
+
+                @Override
+                public void onMessage(MessageContext message) {
+
+                    if (message.getType().equals(MessageType.EXPERIMENT)){
+                        try {
+                            ExperimentStatusChangeEvent event = new ExperimentStatusChangeEvent();
+                            TBase messageEvent = message.getEvent();
+                            byte[] bytes = ThriftUtils.serializeThriftObject(messageEvent);
+                            ThriftUtils.createThriftFromBytes(bytes, event);
+                            ExperimentState expState = event.getState();
+                            if (expState.equals(ExperimentState.COMPLETED)){
+                                // check file transfers
+                                List<OutputDataObjectType> experimentOutputs = airavata.getExperimentOutputs(expId);
+                                int i = 1;
+                                for (OutputDataObjectType output : experimentOutputs){
+                                    logger.info("################ Experiment : " + expId + " COMPLETES ###################");
+                                    logger.info("Output " + i + " : "  + output.getValue());
+                                    i++;
+                                }
+                            }
+                            logger.info(" Experiment Id : '" + expId
+                                    + "' with state : '" + event.getState().toString() +
+                                    " for Gateway " + event.getGatewayId());
+                        } catch (TException e) {
+                            logger.error(e.getMessage(), e);
+                        }
+                    }else if (message.getType().equals(MessageType.JOB)){
+                        try {
+                            JobStatusChangeEvent event = new JobStatusChangeEvent();
+                            TBase messageEvent = message.getEvent();
+                            byte[] bytes = ThriftUtils.serializeThriftObject(messageEvent);
+                            ThriftUtils.createThriftFromBytes(bytes, event);
+                            logger.info(" Job ID : '" + event.getJobIdentity().getJobId()
+                                    + "' with state : '" + event.getState().toString() +
+                                    " for Gateway " + event.getJobIdentity().getGatewayId());
+                        } catch (TException e) {
+                            logger.error(e.getMessage(), e);
+                        }
+                    }
+                }
+            });
+        }
+
+
+    }
+
+    public void createAmberExperiment () throws Exception{
+        try {
+            for (String gatewayId : csTokens.keySet()){
+                String token = csTokens.get(gatewayId);
+                Map<String, String> appsWithNames = generateAppsPerGateway(gatewayId);
+                for (String appId : appsWithNames.keySet()){
+                    List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId);
+                    List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId);
+                    String appName = appsWithNames.get(appId);
+                    if (appName.equals(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME)){
+                        String heatRSTFile = propertyReader.readProperty(TestFrameworkConstants.AppcatalogConstants.AMBER_HEAT_RST_LOCATION, PropertyFileType.TEST_FRAMEWORK);
+                        String prodInFile = propertyReader.readProperty(TestFrameworkConstants.AppcatalogConstants.AMBER_PROD_IN_LOCATION, PropertyFileType.TEST_FRAMEWORK);
+                        String prmTopFile = propertyReader.readProperty(TestFrameworkConstants.AppcatalogConstants.AMBER_PRMTOP_LOCATION, PropertyFileType.TEST_FRAMEWORK);
+
+                        for (InputDataObjectType inputDataObjectType : applicationInputs) {
+                            if (inputDataObjectType.getName().equalsIgnoreCase("Heat_Restart_File")) {
+                                inputDataObjectType.setValue(heatRSTFile);
+                            } else if (inputDataObjectType.getName().equalsIgnoreCase("Production_Control_File")) {
+                                inputDataObjectType.setValue(prodInFile);
+                            } else if (inputDataObjectType.getName().equalsIgnoreCase("Parameter_Topology_File")) {
+                                inputDataObjectType.setValue(prmTopFile);
+                            }
+                        }
+
+                        String projectId = getProjectIdForGateway(gatewayId);
+                        Experiment simpleExperiment =
+                                ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "Amber Experiment", "Amber Experiment run", appId, applicationInputs);
+                        simpleExperiment.setExperimentOutputs(appOutputs);
+                        String experimentId;
+                        Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(appId);
+                        if (computeResources != null && computeResources.size() != 0) {
+                            for (String id : computeResources.keySet()) {
+                                String resourceName = computeResources.get(id);
+                                if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.TRESTLES_RESOURCE_NAME)) {
+                                    ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null);
+                                    UserConfigurationData userConfigurationData = new UserConfigurationData();
+                                    userConfigurationData.setAiravataAutoSchedule(false);
+                                    userConfigurationData.setOverrideManualScheduledParams(false);
+                                    userConfigurationData.setComputationalResourceScheduling(scheduling);
+                                    simpleExperiment.setUserConfigurationData(userConfigurationData);
+                                    experimentId = airavata.createExperiment(gatewayId, simpleExperiment);
+                                    experimentsWithTokens.put(experimentId, token);
+                                    experimentsWithGateway.put(experimentId, gatewayId);
+                                }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)) {
+                                    ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null);
+                                    UserConfigurationData userConfigurationData = new UserConfigurationData();
+                                    userConfigurationData.setAiravataAutoSchedule(false);
+                                    userConfigurationData.setOverrideManualScheduledParams(false);
+                                    userConfigurationData.setComputationalResourceScheduling(scheduling);
+                                    simpleExperiment.setUserConfigurationData(userConfigurationData);
+                                    experimentId = airavata.createExperiment(gatewayId, simpleExperiment);
+                                    experimentsWithTokens.put(experimentId, token);
+                                    experimentsWithGateway.put(experimentId, gatewayId);
+                                }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)) {
+                                    ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null);
+                                    UserConfigurationData userConfigurationData = new UserConfigurationData();
+                                    userConfigurationData.setAiravataAutoSchedule(false);
+                                    userConfigurationData.setOverrideManualScheduledParams(false);
+                                    userConfigurationData.setComputationalResourceScheduling(scheduling);
+                                    simpleExperiment.setUserConfigurationData(userConfigurationData);
+                                    experimentId = airavata.createExperiment(gatewayId, simpleExperiment);
+                                    experimentsWithTokens.put(experimentId, token);
+                                    experimentsWithGateway.put(experimentId, gatewayId);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }catch (Exception e){
+            logger.error("Error while creating AMBEr experiment", e);
+            throw new Exception("Error while creating AMBER experiment", e);
+        }
+    }
+
+    public String getProjectIdForGateway (String gatewayId){
+        for (String projectId : projectsMap.keySet()){
+            String gateway = projectsMap.get(projectId);
+            if (gateway.equals(gatewayId)){
+                return projectId;
+            }
+        }
+        return null;
+    }
+
+    public Map<String, String> generateAppsPerGateway (String gatewayId) throws Exception {
+        Map<String, String> appWithNames = new HashMap<String, String>();
+        try {
+            for (String appId : appInterfaceMap.keySet()){
+                String gateway = appInterfaceMap.get(appId);
+                ApplicationInterfaceDescription applicationInterface = airavata.getApplicationInterface(appId);
+                if (gateway.equals(gatewayId)){
+                    appWithNames.put(appId, applicationInterface.getApplicationName());
+                }
+            }
+        }catch (Exception e){
+            logger.error("Error while getting application interface", e);
+            throw new Exception("Error while getting application interface", e);
+        }
+
+        return appWithNames;
+    }
+
+    public void createEchoExperiment () throws Exception{
+        try {
+            for (String gatewayId : csTokens.keySet()) {
+                String token = csTokens.get(gatewayId);
+                Map<String, String> appsWithNames = generateAppsPerGateway(gatewayId);
+                for (String appId : appsWithNames.keySet()) {
+                    List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId);
+                    List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId);
+                    String appName = appsWithNames.get(appId);
+                    if (appName.equals(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME)) {
+                        for (InputDataObjectType inputDataObjectType : applicationInputs) {
+                            if (inputDataObjectType.getName().equalsIgnoreCase("input_to_Echo")) {
+                                inputDataObjectType.setValue("Hello World !!!");
+                            }
+                        }
+
+                        String projectId = getProjectIdForGateway(gatewayId);
+                        Experiment simpleExperiment =
+                                ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "Echo Experiment", "Echo Experiment run", appId, applicationInputs);
+                        simpleExperiment.setExperimentOutputs(appOutputs);
+                        String experimentId;
+                        Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(appId);
+                        if (computeResources != null && computeResources.size() != 0) {
+                            for (String id : computeResources.keySet()) {
+                                String resourceName = computeResources.get(id);
+                                if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.TRESTLES_RESOURCE_NAME)) {
+                                    ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null);
+                                    UserConfigurationData userConfigurationData = new UserConfigurationData();
+                                    userConfigurationData.setAiravataAutoSchedule(false);
+                                    userConfigurationData.setOverrideManualScheduledParams(false);
+                                    userConfigurationData.setComputationalResourceScheduling(scheduling);
+                                    simpleExperiment.setUserConfigurationData(userConfigurationData);
+                                    experimentId = airavata.createExperiment(gatewayId, simpleExperiment);
+                                    experimentsWithTokens.put(experimentId, token);
+                                    experimentsWithGateway.put(experimentId, gatewayId);
+                                } else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)) {
+                                    ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null);
+                                    UserConfigurationData userConfigurationData = new UserConfigurationData();
+                                    userConfigurationData.setAiravataAutoSchedule(false);
+                                    userConfigurationData.setOverrideManualScheduledParams(false);
+                                    userConfigurationData.setComputationalResourceScheduling(scheduling);
+                                    simpleExperiment.setUserConfigurationData(userConfigurationData);
+                                    experimentId = airavata.createExperiment(gatewayId, simpleExperiment);
+                                    experimentsWithTokens.put(experimentId, token);
+                                    experimentsWithGateway.put(experimentId, gatewayId);
+                                } else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)) {
+                                    ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null);
+                                    UserConfigurationData userConfigurationData = new UserConfigurationData();
+                                    userConfigurationData.setAiravataAutoSchedule(false);
+                                    userConfigurationData.setOverrideManualScheduledParams(false);
+                                    userConfigurationData.setComputationalResourceScheduling(scheduling);
+                                    simpleExperiment.setUserConfigurationData(userConfigurationData);
+                                    experimentId = airavata.createExperiment(gatewayId, simpleExperiment);
+                                    experimentsWithTokens.put(experimentId, token);
+                                    experimentsWithGateway.put(experimentId, gatewayId);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }catch (Exception e){
+            logger.error("Error while creating Echo experiment", e);
+            throw new Exception("Error while creating Echo experiment", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7812dcaf/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
index 4cfdab2..9b94d4e 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
@@ -107,7 +107,7 @@ public class Setup {
         project.setName("testProj_" + gatewayId);
         project.setOwner("testUser_" + gatewayId);
         String projectId = airavata.createProject(gatewayId, project);
-        projectMap.put(gatewayId, projectId);
+        projectMap.put(projectId, gatewayId);
     }
 
     public void registerSSHKeys () throws Exception{

http://git-wip-us.apache.org/repos/asf/airavata/blob/7812dcaf/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
index c4bf8e4..f64ce67 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/utils/TestFrameworkConstants.java
@@ -32,6 +32,8 @@ public class TestFrameworkConstants {
         public static final String CS_JBDC_DRIVER = "credential.store.jdbc.driver";
         public static final String CS_DB_USERNAME = "credential.store.jdbc.user";
         public static final String CS_DB_PWD = "credential.store.jdbc.password";
+        public static final String RABBIT_BROKER_URL = "rabbitmq.broker.url";
+        public static final String RABBIT_EXCHANGE_NAME = "rabbitmq.exchange.name";
     }
 
     public static final class FrameworkPropertiesConstants {
@@ -81,6 +83,14 @@ public class TestFrameworkConstants {
         public static final String STAMPEDE_RESOURCE_NAME = "stampede.tacc.xsede.org";
         public static final String TRESTLES_RESOURCE_NAME = "trestles.sdsc.xsede.org";
         public static final String BR2_RESOURCE_NAME = "bigred2.uits.iu.edu";
+
+
+        public static final String AMBER_HEAT_RST_LOCATION = "02_Heat.rst_location";
+        public static final String AMBER_PROD_IN_LOCATION = "03_Prod.in_location";
+        public static final String AMBER_PRMTOP_LOCATION = "prmtop_location";
+
+
+
     }
 
     public static final class CredentialStoreConstants {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7812dcaf/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties b/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
index 4513c21..c44bd1f 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
@@ -45,4 +45,11 @@ credential.store.jdbc.password=airavata
 credential.store.jdbc.driver=org.apache.derby.jdbc.ClientDriver
 
 
+######################################################################
+# rabbitMQ related properties - monitoring is done with rabbitMQ
+######################################################################
+rabbitmq.exchange.name=airavata_rabbitmq_exchange
+rabbitmq.broker.url=amqp://localhost:5672
+
+
 


[08/11] airavata git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata

Posted by sh...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ac9dc30f
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ac9dc30f
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ac9dc30f

Branch: refs/heads/emailMonitoring
Commit: ac9dc30f53e2b64ce7abb0d0cf724770d51d10d6
Parents: 9a0024a 26cf7ed
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Wed Apr 1 10:25:14 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Wed Apr 1 10:25:14 2015 -0400

----------------------------------------------------------------------
 .../src/main/resources/appcatalog-mysql.sql     |   4 +-
 .../test-suite/multi-tenanted-airavata/pom.xml  |  15 +
 .../multitenantedairavata/AiravataClient.java   |   4 +-
 .../ApplicationRegister.java                    |  18 +-
 .../ComputeResourceRegister.java                |   7 +-
 .../ExperimentExecution.java                    | 323 +++++++++++++++++++
 .../FrameworkBootstrapping.java                 |  44 +++
 .../multitenantedairavata/FrameworkSetup.java   |  73 +++++
 .../multitenantedairavata/GatewayRegister.java  | 220 +++++++++++++
 .../multitenantedairavata/LoadTester.java       |  50 +++
 .../testsuite/multitenantedairavata/Setup.java  | 208 ------------
 .../utils/TestFrameworkConstants.java           |  10 +
 .../main/resources/airavata-client.properties   |   7 +
 13 files changed, 757 insertions(+), 226 deletions(-)
----------------------------------------------------------------------



[03/11] airavata git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata

Posted by sh...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d8923697
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d8923697
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d8923697

Branch: refs/heads/emailMonitoring
Commit: d89236975ad8e48bed81acccf545a4f2fb301845
Parents: d798cab aff5d92
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Tue Mar 31 10:22:50 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Tue Mar 31 10:22:50 2015 -0400

----------------------------------------------------------------------
 .../client/samples/CreateLaunchBES.java         | 487 +++++++++++++++++++
 .../client/samples/RegisterSampleData.java      |   9 +
 .../tools/RegisterSampleApplications.java       |  38 +-
 .../tools/RegisterSampleApplicationsUtils.java  |   3 +-
 .../appcatalog/cpi/WorkflowCatalog.java         |   4 +
 .../catalog/data/impl/WorkflowCatalogImpl.java  |  21 +
 .../data/resources/WorkflowOutputResource.java  |   4 +-
 .../server/src/main/resources/PBSTemplate.xslt  |   2 +-
 .../gfac/bes/utils/ApplicationProcessor.java    |  58 ++-
 .../airavata/gfac/bes/utils/BESConstants.java   |   4 +
 .../gfac/bes/utils/DataTransferrer.java         |   7 +-
 .../gfac/bes/utils/ResourceProcessor.java       |   8 +-
 .../gfac/bes/utils/UASDataStagingProcessor.java |   5 +-
 .../airavata/gfac/ssh/util/GFACSSHUtils.java    |   3 +-
 .../airavata-orchestrator-service/pom.xml       |   2 +-
 .../test-suite/multi-tenanted-airavata/pom.xml  |  10 +
 .../multitenantedairavata/AiravataClient.java   |   6 +-
 .../ApplicationRegister.java                    | 326 +++++++++++++
 .../ComputeResourceRegister.java                | 226 +++++++++
 .../testsuite/multitenantedairavata/Setup.java  | 178 ++++++-
 .../utils/PropertyReader.java                   |   2 +-
 .../utils/TestFrameworkConstants.java           |  36 ++
 .../main/resources/airavata-client.properties   |  11 +
 .../main/resources/test-framework.properties    |   9 +-
 modules/workflow/workflow-core/pom.xml          |   3 +-
 .../core/SimpleWorkflowInterpreter.java         |  18 +
 .../core/parser/AiravataWorkflowParser.java     |   1 +
 .../ui/dialogs/registry/RegistryWindow.java     |   2 +-
 .../WorkflowInterpreterLaunchWindow.java        | 105 ++--
 29 files changed, 1508 insertions(+), 80 deletions(-)
----------------------------------------------------------------------



[10/11] airavata git commit: Fixed AIRAVATA-1647.

Posted by sh...@apache.org.
Fixed AIRAVATA-1647.

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/732da594
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/732da594
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/732da594

Branch: refs/heads/emailMonitoring
Commit: 732da594f0fc7fefbf1c0c53946db4cf035ef7db
Parents: 764a239
Author: raminder <ra...@apache.org>
Authored: Thu Apr 2 15:34:16 2015 -0400
Committer: raminder <ra...@apache.org>
Committed: Thu Apr 2 15:34:16 2015 -0400

----------------------------------------------------------------------
 .../org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/732da594/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
index cf9f931..3d18013 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
@@ -675,7 +675,7 @@ public class GSISSHAbstractCluster implements Cluster {
         String[] list = command.split(File.separator);
         command = list[list.length - 1];
         // We are checking for stderr containing the command issued. Thus ignores the verbose logs in stderr.
-        if (stdErrorString != null && stdErrorString.contains(command) && !stdErrorString.contains("Warning")) {
+        if (stdErrorString != null && stdErrorString.contains(command.trim()) && !stdErrorString.contains("Warning")) {
             log.error("Standard Error output : " + stdErrorString);
             throw new SSHApiException(errorMsg + "\n\r StandardOutput: "+ stdOutputString + "\n\r StandardError: "+ stdErrorString);
         }else if(stdOutputString.contains("error")){


[07/11] airavata git commit: adding extra logs to do more testing

Posted by sh...@apache.org.
adding extra logs to do more testing


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9a0024a5
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9a0024a5
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9a0024a5

Branch: refs/heads/emailMonitoring
Commit: 9a0024a574029bb10fbcf0146c783e772aa3ebbb
Parents: d892369
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Wed Apr 1 10:25:02 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Wed Apr 1 10:25:02 2015 -0400

----------------------------------------------------------------------
 .../airavata/messaging/core/impl/RabbitMQTaskLaunchPublisher.java   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9a0024a5/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchPublisher.java
----------------------------------------------------------------------
diff --git a/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchPublisher.java b/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchPublisher.java
index 0f95fbf..3d8a377 100644
--- a/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchPublisher.java
+++ b/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchPublisher.java
@@ -72,6 +72,7 @@ public class RabbitMQTaskLaunchPublisher implements Publisher{
             }
             byte[] messageBody = ThriftUtils.serializeThriftObject(message);
             rabbitMQProducer.sendToWorkerQueue(messageBody, routingKey);
+            log.info("Successfully published to launch queue ...");
         } catch (TException e) {
             String msg = "Error while deserializing the object";
             log.error(msg, e);


[11/11] airavata git commit: Merge branch 'master' into emailMonitoring

Posted by sh...@apache.org.
Merge branch 'master' into emailMonitoring


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/b368cb08
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/b368cb08
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/b368cb08

Branch: refs/heads/emailMonitoring
Commit: b368cb08866ac82b90d714350bb41a222875e01c
Parents: fb6e3b6 732da59
Author: shamrath <sh...@gmail.com>
Authored: Fri Apr 3 11:25:06 2015 -0400
Committer: shamrath <sh...@gmail.com>
Committed: Fri Apr 3 11:25:06 2015 -0400

----------------------------------------------------------------------
 .../AiravataExperimentStatusUpdator.java        |  43 ++-
 .../client/samples/CreateLaunchExperiment.java  |   6 +-
 .../src/main/resources/appcatalog-mysql.sql     |   4 +-
 .../airavata/common/utils/AiravataZKUtils.java  |  31 +-
 .../airavata/gfac/server/GfacServerHandler.java |   2 +-
 .../airavata/gfac/core/cpi/BetterGfacImpl.java  |   4 +-
 .../AiravataWorkflowNodeStatusUpdator.java      |   2 +
 .../core/monitor/GfacInternalStatusUpdator.java |  17 -
 .../airavata/gfac/core/utils/GFacUtils.java     |  75 +++--
 .../handlers/GridPullMonitorHandler.java        |   2 +-
 .../monitor/impl/pull/qstat/HPCPullMonitor.java |   2 +
 .../core/impl/RabbitMQTaskLaunchPublisher.java  |   1 +
 .../util/OrchestratorRecoveryHandler.java       |   2 +-
 .../test-suite/multi-tenanted-airavata/pom.xml  |  15 +
 .../multitenantedairavata/AiravataClient.java   |   4 +-
 .../ApplicationRegister.java                    | 299 +++++++++++++++++
 .../ComputeResourceRegister.java                | 160 +++++++--
 .../ExperimentExecution.java                    | 323 +++++++++++++++++++
 .../FrameworkBootstrapping.java                 |  44 +++
 .../multitenantedairavata/FrameworkSetup.java   |  73 +++++
 .../multitenantedairavata/GatewayRegister.java  | 220 +++++++++++++
 .../multitenantedairavata/LoadTester.java       |  50 +++
 .../testsuite/multitenantedairavata/Setup.java  | 208 ------------
 .../utils/TestFrameworkConstants.java           |  37 +++
 .../main/resources/airavata-client.properties   |   7 +
 .../main/resources/test-framework.properties    |   9 +-
 .../gsi/ssh/impl/GSISSHAbstractCluster.java     |   2 +-
 27 files changed, 1336 insertions(+), 306 deletions(-)
----------------------------------------------------------------------



[09/11] airavata git commit: fixing gfac status updating with worker queuest

Posted by sh...@apache.org.
fixing gfac status updating with worker queuest


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/764a2393
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/764a2393
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/764a2393

Branch: refs/heads/emailMonitoring
Commit: 764a23933225075b7a36146d284e9d238d3d280a
Parents: ac9dc30
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Wed Apr 1 12:38:32 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Wed Apr 1 12:38:32 2015 -0400

----------------------------------------------------------------------
 .../AiravataExperimentStatusUpdator.java        | 43 +++++++++--
 .../client/samples/CreateLaunchExperiment.java  |  6 +-
 .../airavata/common/utils/AiravataZKUtils.java  | 31 +++++++-
 .../airavata/gfac/server/GfacServerHandler.java |  2 +-
 .../airavata/gfac/core/cpi/BetterGfacImpl.java  |  4 +-
 .../AiravataWorkflowNodeStatusUpdator.java      |  2 +
 .../core/monitor/GfacInternalStatusUpdator.java | 17 -----
 .../airavata/gfac/core/utils/GFacUtils.java     | 75 +++++++++++---------
 .../handlers/GridPullMonitorHandler.java        |  2 +-
 .../util/OrchestratorRecoveryHandler.java       |  2 +-
 10 files changed, 118 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
index 1efa506..aabba55 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
@@ -22,12 +22,13 @@ package org.apache.airavata.api.server.listener;
 
 import com.google.common.eventbus.Subscribe;
 import org.apache.airavata.api.server.util.DataModelUtils;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.MonitorPublisher;
-import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.common.exception.AiravataException;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.*;
 import org.apache.airavata.common.utils.listener.AbstractActivityListener;
 import org.apache.airavata.messaging.core.MessageContext;
 import org.apache.airavata.messaging.core.Publisher;
+import org.apache.airavata.messaging.core.impl.RabbitMQTaskLaunchConsumer;
 import org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent;
 import org.apache.airavata.model.messaging.event.MessageType;
 import org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent;
@@ -36,18 +37,29 @@ import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.model.workspace.experiment.ExperimentState;
 import org.apache.airavata.registry.cpi.Registry;
 import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.ZKUtil;
+import org.apache.zookeeper.ZooKeeper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
 import java.util.Calendar;
 
 public class AiravataExperimentStatusUpdator implements AbstractActivityListener {
     private final static Logger logger = LoggerFactory.getLogger(AiravataExperimentStatusUpdator.class);
 
     private Registry airavataRegistry;
+
     private MonitorPublisher monitorPublisher;
+
     private Publisher publisher;
 
+    private ZooKeeper zk;
+
+    private RabbitMQTaskLaunchConsumer consumer;
+
+
     public Registry getAiravataRegistry() {
         return airavataRegistry;
     }
@@ -61,7 +73,9 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
 		try {
 			boolean updateExperimentStatus=true;
 			ExecutionType executionType = DataModelUtils.getExecutionType((Experiment) airavataRegistry.get(RegistryModelType.EXPERIMENT, nodeStatus.getWorkflowNodeIdentity().getExperimentId()));
-			
+            String experimentNode = ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, "/gfac-experiments");
+            String experimentPath = experimentNode + File.separator + ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME)
+                    + File.separator + nodeStatus.getWorkflowNodeIdentity().getExperimentId();
 	        ExperimentState state = ExperimentState.UNKNOWN;
 	        switch (nodeStatus.getState()) {
 	            case CANCELED:
@@ -73,19 +87,23 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
 	            	}else{
 	                state = ExperimentState.EXECUTING; updateExperimentStatus = true;
 	                }
+
+                    cleanup(nodeStatus, experimentNode, experimentPath);
 	                break;
 	            case INVOKED:
 	                state = ExperimentState.LAUNCHED; updateExperimentStatus = false;
 	                break;
 	            case FAILED:
 	                state = ExperimentState.FAILED; updateExperimentStatus = true;
+                    cleanup(nodeStatus,experimentNode,experimentPath);
 	                break;
 	            case EXECUTING:
 	                state = ExperimentState.EXECUTING; updateExperimentStatus = true;
 	                break;
 	            case CANCELING:
 	                state = ExperimentState.CANCELING; updateExperimentStatus = true;
-	                break;
+                    cleanup(nodeStatus,experimentNode,experimentPath);
+                    break;
 	            default:
 	                return;
 	        }
@@ -109,7 +127,15 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
             throw new Exception("Error persisting experiment status..", e);
 		}
     }
-    
+
+    private void cleanup(WorkflowNodeStatusChangeEvent nodeStatus, String experimentNode, String experimentPath) throws ApplicationSettingsException, KeeperException, InterruptedException, AiravataException {
+        if (ServerSettings.isGFacPassiveMode()) {
+            consumer.sendAck(AiravataZKUtils.getDeliveryTag(nodeStatus.getWorkflowNodeIdentity().getExperimentId(), zk, experimentNode, ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME)));
+        }
+        ZKUtil.deleteRecursive(zk, experimentPath + AiravataZKUtils.DELIVERY_TAG_POSTFIX);
+        ZKUtil.deleteRecursive(zk, experimentPath);
+    }
+
     public  ExperimentState updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
     	Experiment details = (Experiment)airavataRegistry.get(RegistryModelType.EXPERIMENT, experimentId);
         if(details == null) {
@@ -140,7 +166,12 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
 				this.monitorPublisher=(MonitorPublisher) configuration;
 			} else if (configuration instanceof Publisher){
                 this.publisher=(Publisher) configuration;
+            }else if (configuration instanceof RabbitMQTaskLaunchConsumer) {
+                this.consumer = (RabbitMQTaskLaunchConsumer) configuration;
+            }else if (configuration instanceof ZooKeeper) {
+                this.zk = (ZooKeeper) configuration;
             }
+
         }
 	}
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/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 4274fbe..0652fbc 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
@@ -58,7 +58,7 @@ public class CreateLaunchExperiment {
     private static final String DEFAULT_GATEWAY = "php_reference_gateway";
     private static Airavata.Client airavataClient;
 
-    private static String echoAppId = "Echo_5dd52cd4-f9a0-459f-9baf-f8e715e44548";
+    private static String echoAppId = "Echo_11afd5ec-e04e-45c9-843b-0c5b28a617f8";
     private static String mpiAppId = "HelloMPI_bfd56d58-6085-4b7f-89fc-646576830518";
     private static String wrfAppId = "WRF_7ad5da38-c08b-417c-a9ea-da9298839762";
     private static String amberAppId = "Amber_aa083c86-4680-4002-b3ef-fad93c181926";
@@ -165,10 +165,10 @@ public class CreateLaunchExperiment {
             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 = createMPIExperimentForFSD(airavataClient);
 //               final String expId = createEchoExperimentForStampede(airavataClient);
 //                final String expId = createEchoExperimentForTrestles(airavataClient);
-//                final String expId = createExperimentEchoForLocalHost(airavataClient);
+                final String expId = createExperimentEchoForLocalHost(airavataClient);
                 experimentIds.add(expId);
 //                final String expId = createExperimentWRFTrestles(airavataClient);
 //                final String expId = createExperimentForBR2(airavataClient);

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
index a0cc142..11c03fb 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.common.utils;
 
+import org.apache.airavata.common.exception.AiravataException;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
@@ -45,18 +46,20 @@ public class AiravataZKUtils {
 
     public static final String ZK_EXPERIMENT_STATE_NODE = "state";
 
+    public static final String DELIVERY_TAG_POSTFIX = "-deliveryTag";
+
     public static String getExpZnodePath(String experimentId, String taskId) throws ApplicationSettingsException {
         return ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE) +
                 File.separator +
                 ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME) + File.separator
-                + experimentId + "+" + taskId;
+                + experimentId;
     }
 
     public static String getExpZnodeHandlerPath(String experimentId, String taskId, String className) throws ApplicationSettingsException {
         return ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE) +
                 File.separator +
                 ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME) + File.separator
-                + experimentId + "+" + taskId + File.separator + className;
+                + experimentId + File.separator + className;
     }
 
     public static String getZKhostPort() throws ApplicationSettingsException {
@@ -196,6 +199,30 @@ public class AiravataZKUtils {
         return bytes;
     }
 
+    public static long getDeliveryTag(String experimentID, ZooKeeper zk, String experimentNode,
+                                      String pickedChild) throws KeeperException, InterruptedException,AiravataException {
+        String experimentPath = experimentNode + File.separator + pickedChild;
+        String deliveryTagPath = experimentPath + File.separator + experimentID
+                + DELIVERY_TAG_POSTFIX;
+        Stat exists = zk.exists(deliveryTagPath, false);
+        if(exists==null) {
+            throw new AiravataException("Cannot find delivery Tag for this experiment");
+        }
+        return bytesToLong(zk.getData(deliveryTagPath, false, exists));
+    }
+    public static byte[] longToBytes(long x) {
+        ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
+        buffer.putLong(x);
+        return buffer.array();
+    }
+
+    public static long bytesToLong(byte[] bytes) {
+        ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
+        buffer.put(bytes);
+        buffer.flip();//need flip
+        return buffer.getLong();
+    }
+
     public static double toDouble(byte[] bytes) {
         return ByteBuffer.wrap(bytes).getDouble();
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index cf83aaa..f2c5075 100644
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -239,7 +239,7 @@ public class GfacServerHandler implements GfacService.Iface, Watcher {
     public boolean submitJob(String experimentId, String taskId, String gatewayId) throws TException {
         requestCount++;
         logger.info("-----------------------------------------------------" + requestCount+"-----------------------------------------------------");
-        logger.infoId(experimentId, "GFac Received submit jog request for the Experiment: {} TaskId: {}", experimentId, taskId);
+        logger.infoId(experimentId, "GFac Received submit job request for the Experiment: {} TaskId: {}", experimentId, taskId);
         GFac gfac = getGfac();
         InputHandlerWorker inputHandlerWorker = new InputHandlerWorker(gfac, experimentId, taskId, gatewayId);
 //        try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
index 3cd07c6..8d09a09 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
@@ -478,7 +478,7 @@ public class BetterGfacImpl implements GFac,Watcher {
         // We need to check whether this job is submitted as a part of a large workflow. If yes,
         // we need to setup workflow tracking listerner.
         try {
-            String experimentEntry = GFacUtils.findExperimentEntry(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(), zk);
+            String experimentEntry = GFacUtils.findExperimentEntry(jobExecutionContext.getExperimentID(), zk);
             Stat exists = zk.exists(experimentEntry + File.separator + "operation", false);
             zk.getData(experimentEntry + File.separator + "operation", this, exists);
             int stateVal = GFacUtils.getZKExperimentStateValue(zk, jobExecutionContext);   // this is the original state came, if we query again it might be different,so we preserve this state in the environment
@@ -534,7 +534,7 @@ public class BetterGfacImpl implements GFac,Watcher {
         // we need to setup workflow tracking listener.
         try {
             // we cannot call GFacUtils.getZKExperimentStateValue because experiment might be running in some other node
-            String expPath = GFacUtils.findExperimentEntry(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(), zk);
+            String expPath = GFacUtils.findExperimentEntry(jobExecutionContext.getExperimentID(), zk);
             int stateVal = GFacUtils.getZKExperimentStateValue(zk, expPath);   // this is the original state came, if we query again it might be different,so we preserve this state in the environment
             monitorPublisher.publish(new GfacExperimentStateChangeRequest(new MonitorID(jobExecutionContext)
                     , GfacExperimentState.ACCEPTED));                  // immediately we get the request we update the status

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
index 8a93c40..cf90987 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
@@ -49,6 +49,8 @@ public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListen
     private Publisher publisher;
 
 
+
+
     public Registry getAiravataRegistry() {
         return airavataRegistry;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/GfacInternalStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/GfacInternalStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/GfacInternalStatusUpdator.java
index 6c456b0..d03237e 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/GfacInternalStatusUpdator.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/GfacInternalStatusUpdator.java
@@ -47,8 +47,6 @@ public class GfacInternalStatusUpdator implements AbstractActivityListener, Watc
 
     private static Integer mutex = -1;
 
-    private RabbitMQTaskLaunchConsumer consumer;
-
     @Subscribe
     public void updateZK(GfacExperimentStateChangeRequest statusChangeRequest) throws Exception {
         logger.info("Gfac internal state changed to: " + statusChangeRequest.getState().toString());
@@ -94,22 +92,10 @@ public class GfacInternalStatusUpdator implements AbstractActivityListener, Watc
             case COMPLETED:
                 logger.info("Experiment Completed, So removing the ZK entry for the experiment" + monitorID.getExperimentID());
                 logger.info("Zookeeper experiment Path: " + experimentPath);
-                if (ServerSettings.isGFacPassiveMode()) {
-                    consumer.sendAck(GFacUtils.getDeliveryTag(statusChangeRequest.getMonitorID().getExperimentID(),
-                            monitorID.getTaskID(), zk, experimentNode, ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME)));
-                }
-                ZKUtil.deleteRecursive(zk,experimentPath+GFacUtils.DELIVERY_TAG_POSTFIX);
-                ZKUtil.deleteRecursive(zk, experimentPath);
                 break;
             case FAILED:
                 logger.info("Experiment Failed, So removing the ZK entry for the experiment" + monitorID.getExperimentID());
                 logger.info("Zookeeper experiment Path: " + experimentPath);
-                if (ServerSettings.isGFacPassiveMode()) {
-                    consumer.sendAck(GFacUtils.getDeliveryTag(statusChangeRequest.getMonitorID().getExperimentID(),
-                            monitorID.getTaskID(), zk, experimentNode, ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME)));
-                }
-                ZKUtil.deleteRecursive(zk,experimentPath+GFacUtils.DELIVERY_TAG_POSTFIX);
-                ZKUtil.deleteRecursive(zk, experimentPath);
                 break;
             default:
         }
@@ -120,9 +106,6 @@ public class GfacInternalStatusUpdator implements AbstractActivityListener, Watc
             if (configuration instanceof ZooKeeper) {
                 this.zk = (ZooKeeper) configuration;
             }
-            if (configuration instanceof RabbitMQTaskLaunchConsumer) {
-                this.consumer = (RabbitMQTaskLaunchConsumer) configuration;
-            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
index a0fc2cb..80bc37f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -20,6 +20,7 @@
  */
 package org.apache.airavata.gfac.core.utils;
 
+import edu.uiuc.ncsa.security.delegation.services.Server;
 import org.airavata.appcatalog.cpi.AppCatalog;
 import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
@@ -67,7 +68,6 @@ import java.util.*;
 
 public class GFacUtils {
 	private final static Logger log = LoggerFactory.getLogger(GFacUtils.class);
-	public static final String DELIVERY_TAG_POSTFIX = "-deliveryTag";
 
 	private GFacUtils() {
 	}
@@ -1051,10 +1051,9 @@ public class GFacUtils {
 													  String pickedChild, String tokenId) throws KeeperException,
 			InterruptedException {
 		String experimentPath = experimentNode + File.separator + pickedChild;
-		String newExpNode = experimentPath + File.separator + experimentID
-				+ "+" + taskID;
+		String newExpNode = experimentPath + File.separator + experimentID;
         Stat exists1 = zk.exists(newExpNode, false);
-        String experimentEntry = GFacUtils.findExperimentEntry(experimentID, taskID, zk);
+        String experimentEntry = GFacUtils.findExperimentEntry(experimentID, zk);
         String foundExperimentPath = null;
 		if (exists1 == null && experimentEntry == null) {  // this means this is a very new experiment
 			List<String> runningGfacNodeNames = AiravataZKUtils
@@ -1063,8 +1062,7 @@ public class GFacUtils {
 			for (String gfacServerNode : runningGfacNodeNames) {
 				if (!gfacServerNode.equals(pickedChild)) {
 					foundExperimentPath = experimentNode + File.separator
-							+ gfacServerNode + File.separator + experimentID
-							+ "+" + taskID;
+							+ gfacServerNode + File.separator + experimentID;
 					exists1 = zk.exists(foundExperimentPath, false);
 					if (exists1 != null) { // when the experiment is found we
 											// break the loop
@@ -1131,7 +1129,7 @@ public class GFacUtils {
 				log.info("Deleting experiment data: " + foundExperimentPath);
 				ZKUtil.deleteRecursive(zk, foundExperimentPath);
 			}
-		}else if(experimentEntry != null && GFacUtils.isCancelled(experimentID,taskID,zk) ){
+		}else if(experimentEntry != null && GFacUtils.isCancelled(experimentID,zk) ){
             // this happens when a cancel request comes to a differnt gfac node, in this case we do not move gfac experiment
             // node to gfac node specific location, because original request execution will fail with errors
             log.error("This experiment is already cancelled and its already executing the cancel operation so cannot submit again !");
@@ -1145,8 +1143,7 @@ public class GFacUtils {
             for (String gfacServerNode : runningGfacNodeNames) {
                 if (!gfacServerNode.equals(pickedChild)) {
                     foundExperimentPath = experimentNode + File.separator
-                            + gfacServerNode + File.separator + experimentID
-                            + "+" + taskID;
+                            + gfacServerNode + File.separator + experimentID;
                     break;
                 }
             }
@@ -1161,10 +1158,9 @@ public class GFacUtils {
 														  String pickedChild, String tokenId, long deliveryTag) throws KeeperException,
 			InterruptedException, ApplicationSettingsException {
 		String experimentPath = experimentNode + File.separator + pickedChild;
-		String newExpNode = experimentPath + File.separator + experimentID
-				+ "+" + taskID;
+		String newExpNode = experimentPath + File.separator + experimentID;
 		Stat exists1 = zk.exists(newExpNode, false);
-		String experimentEntry = GFacUtils.findExperimentEntry(experimentID, taskID, zk);
+		String experimentEntry = GFacUtils.findExperimentEntry(experimentID, zk);
 		if (exists1 != null) {
 			log.error("This request is wrong because its already running in the same instance");
 			return false;
@@ -1186,7 +1182,7 @@ public class GFacUtils {
 			String s1 = zk.create(newExpNode + File.separator + "operation", "submit".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
 					CreateMode.PERSISTENT);
 			zk.exists(s1, true);// we want to know when this node get deleted
-			String s2 = zk.create(newExpNode + DELIVERY_TAG_POSTFIX, longToBytes(deliveryTag), ZooDefs.Ids.OPEN_ACL_UNSAFE,  // here we store the value of delivery message
+			String s2 = zk.create(newExpNode + AiravataZKUtils.DELIVERY_TAG_POSTFIX, longToBytes(deliveryTag), ZooDefs.Ids.OPEN_ACL_UNSAFE,  // here we store the value of delivery message
 					CreateMode.PERSISTENT);
 		} else {
 			log.error("ExperimentID: " + experimentID + " taskID: " + taskID
@@ -1237,16 +1233,14 @@ public class GFacUtils {
 	 * @throws KeeperException
 	 * @throws InterruptedException
 	 */
-    public static String findExperimentEntry(String experimentID,
-                                                String taskID, ZooKeeper zk
+    public static String findExperimentEntry(String experimentID, ZooKeeper zk
                                                 ) throws KeeperException,
             InterruptedException {
         String experimentNode = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, "/gfac-experiments");
         List<String> children = zk.getChildren(experimentNode, false);
         for(String pickedChild:children) {
             String experimentPath = experimentNode + File.separator + pickedChild;
-            String newExpNode = experimentPath + File.separator + experimentID
-                    + "+" + taskID;
+            String newExpNode = experimentPath + File.separator + experimentID;
             Stat exists = zk.exists(newExpNode, false);
             if(exists == null){
                 continue;
@@ -1257,9 +1251,36 @@ public class GFacUtils {
         return null;
     }
 
+	/**
+	 * This will return a value if the server is down because we iterate through exisiting experiment nodes, not
+	 * through gfac-server nodes
+	 * @param experimentID
+	 * @param zk
+	 * @return
+	 * @throws KeeperException
+	 * @throws InterruptedException
+	 */
+	public static String findExperimentEntryPassive(String experimentID, ZooKeeper zk
+	) throws KeeperException,
+			InterruptedException {
+		String experimentNode = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, "/gfac-experiments");
+		List<String> children = zk.getChildren(experimentNode, false);
+		for(String pickedChild:children) {
+			String experimentPath = experimentNode + File.separator + pickedChild;
+			String newExpNode = experimentPath + File.separator + experimentID;
+			Stat exists = zk.exists(newExpNode, false);
+			if(exists == null){
+				continue;
+			}else{
+				return newExpNode;
+			}
+		}
+		return null;
+	}
+
     public static void setExperimentCancel(String experimentId,String taskId,ZooKeeper zk)throws KeeperException,
             InterruptedException {
-        String experimentEntry = GFacUtils.findExperimentEntry(experimentId, taskId, zk);
+        String experimentEntry = GFacUtils.findExperimentEntry(experimentId, zk);
         if(experimentEntry == null){
             log.error("Cannot find the experiment Entry, so cancel operation cannot be performed !!!");
         }else {
@@ -1273,11 +1294,11 @@ public class GFacUtils {
         }
 
     }
-    public static boolean isCancelled(String experimentID,
-                                             String taskID, ZooKeeper zk
+    public static boolean isCancelled(String experimentID, ZooKeeper zk
     ) throws KeeperException,
             InterruptedException {
-        String experimentEntry = GFacUtils.findExperimentEntry(experimentID, taskID, zk);
+		String experimentEntry = GFacUtils.findExperimentEntry(experimentID, zk);
+
         if(experimentEntry == null){
             return false;
         }else {
@@ -1311,18 +1332,6 @@ public class GFacUtils {
 		}
 	}
 
-	public static long getDeliveryTag(String experimentID,
-									  String taskID, ZooKeeper zk, String experimentNode,
-									  String pickedChild) throws KeeperException, InterruptedException,GFacException {
-		String experimentPath = experimentNode + File.separator + pickedChild;
-		String deliveryTagPath = experimentPath + File.separator + experimentID
-				+ "+" + taskID + DELIVERY_TAG_POSTFIX;
-		Stat exists = zk.exists(deliveryTagPath, false);
-		if(exists==null) {
-			throw new GFacException("Cannot find delivery Tag for this experiment");
-		}
-		return bytesToLong(zk.getData(deliveryTagPath, false, exists));
-	}
 	public static String getPluginData(JobExecutionContext jobExecutionContext,
 			String className) throws ApplicationSettingsException,
 			KeeperException, InterruptedException {

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
index d5f9f90..24b300e 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
@@ -89,7 +89,7 @@ public class GridPullMonitorHandler extends ThreadedHandler implements Watcher{
         try {
             ZooKeeper zk = jobExecutionContext.getZk();
             try {
-                String experimentEntry = GFacUtils.findExperimentEntry(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(), zk);
+                String experimentEntry = GFacUtils.findExperimentEntry(jobExecutionContext.getExperimentID(), zk);
                 String path = experimentEntry + File.separator + "operation";
                 Stat exists = zk.exists(path, this);
                 if (exists != null) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/764a2393/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorRecoveryHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorRecoveryHandler.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorRecoveryHandler.java
index 993a303..9005f70 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorRecoveryHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorRecoveryHandler.java
@@ -81,7 +81,7 @@ public class OrchestratorRecoveryHandler implements Watcher {
             log.info("Recovering Experiment: " + expId.split("\\+")[0]);
             log.info("------------------------------------------------------------------------------------");
             try {
-                if(GFacUtils.isCancelled(expId.split("\\+")[0], expId.split("\\+")[1], zk)) {// during relaunching we check the operation and then launch
+                if(GFacUtils.isCancelled(expId.split("\\+")[0], zk)) {// during relaunching we check the operation and then launch
                     serverHandler.terminateExperiment(expId.split("\\+")[0]);
                 }else {
                     serverHandler.launchExperiment(expId.split("\\+")[0], null);


[05/11] airavata git commit: Adding main classes - AIRAVATA-1652

Posted by sh...@apache.org.
Adding main classes - AIRAVATA-1652


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/1f9ac846
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1f9ac846
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1f9ac846

Branch: refs/heads/emailMonitoring
Commit: 1f9ac846aa0c3bf3f3ec41b3c818780baf280207
Parents: 7812dca
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Mar 31 16:37:28 2015 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Mar 31 16:37:28 2015 -0400

----------------------------------------------------------------------
 .../test-suite/multi-tenanted-airavata/pom.xml  |   5 +
 .../multitenantedairavata/AiravataClient.java   |   4 +-
 .../ApplicationRegister.java                    |  16 +-
 .../ComputeResourceRegister.java                |   7 +-
 .../ExperimentExecution.java                    |   2 -
 .../FrameworkBootstrapping.java                 |  44 ++++
 .../multitenantedairavata/FrameworkSetup.java   |  73 ++++++
 .../multitenantedairavata/GatewayRegister.java  | 220 +++++++++++++++++++
 .../multitenantedairavata/LoadTester.java       |  50 +++++
 .../testsuite/multitenantedairavata/Setup.java  | 208 ------------------
 10 files changed, 405 insertions(+), 224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/pom.xml
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/pom.xml b/modules/test-suite/multi-tenanted-airavata/pom.xml
index f974c59..9068996 100644
--- a/modules/test-suite/multi-tenanted-airavata/pom.xml
+++ b/modules/test-suite/multi-tenanted-airavata/pom.xml
@@ -74,6 +74,11 @@
             <artifactId>airavata-credential-store</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!--<dependency>-->
+            <!--<groupId>mysql</groupId>-->
+            <!--<artifactId>mysql-connector-java</artifactId>-->
+            <!--<version>5.1.35</version>-->
+        <!--</dependency>-->
         <dependency>
             <groupId>org.apache.derby</groupId>
             <artifactId>derbyclient</artifactId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/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 b20cdc2..5126249 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
@@ -45,7 +45,7 @@ public class AiravataClient {
         propertyReader = new PropertyReader();
     }
 
-    public Airavata.Client getAiravataClient(){
+    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));
@@ -53,7 +53,7 @@ public class AiravataClient {
             return airavataClient;
         } catch (AiravataClientConnectException e) {
             logger.error("Error while creating airavata client instance", e);
+            throw new Exception("Error while creating airavata client instance", e);
         }
-        return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/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 8e71958..d73ccba 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
@@ -83,7 +83,7 @@ public class ApplicationRegister {
         addLAMMPSApplication();
     }
 
-    public void addAmberApplication () throws Exception{
+    protected void addAmberApplication () throws Exception{
         for (Gateway gateway : allGateways){
             // add amber module
             String amberModuleId = airavata.registerApplicationModule(gateway.getGatewayId(),
@@ -185,7 +185,7 @@ public class ApplicationRegister {
     }
 
 
-    public void addEchoApplication() throws Exception{
+    protected void addEchoApplication() throws Exception{
         for (Gateway gateway : allGateways){
             // add echo module
             String echoModuleId = airavata.registerApplicationModule(gateway.getGatewayId(),
@@ -218,14 +218,14 @@ public class ApplicationRegister {
         }
     }
 
-    public void addLAMMPSApplication() throws Exception{
+    protected void addLAMMPSApplication() throws Exception{
         // add LAMPPS module
         // add LAMPSS interface
         // add LAMPSS deployment
     }
 
 
-    public static ApplicationDeploymentDescription createApplicationDeployment(String appModuleId,
+    protected ApplicationDeploymentDescription createApplicationDeployment(String appModuleId,
                                                                                String computeResourceId,
                                                                                String executablePath,
                                                                                ApplicationParallelismType parallelism,
@@ -245,7 +245,7 @@ public class ApplicationRegister {
         return deployment;
     }
 
-    public static ApplicationModule createApplicationModule(String appModuleName,
+    protected ApplicationModule createApplicationModule(String appModuleName,
                                                             String appModuleVersion, String appModuleDescription) {
         ApplicationModule module = new ApplicationModule();
         module.setAppModuleDescription(appModuleDescription);
@@ -254,7 +254,7 @@ public class ApplicationRegister {
         return module;
     }
 
-    public static InputDataObjectType createAppInput (String inputName,
+    protected InputDataObjectType createAppInput (String inputName,
                                                       String value,
                                                       DataType type,
                                                       String applicationArgument,
@@ -278,7 +278,7 @@ public class ApplicationRegister {
         return input;
     }
 
-    public static OutputDataObjectType createAppOutput(String inputName,
+    protected OutputDataObjectType createAppOutput(String inputName,
                                                        String value,
                                                        DataType type,
                                                        boolean isRequired,
@@ -292,7 +292,7 @@ public class ApplicationRegister {
         return outputDataObjectType;
     }
 
-    public static ApplicationInterfaceDescription createApplicationInterfaceDescription
+    protected ApplicationInterfaceDescription createApplicationInterfaceDescription
             (String applicationName, String applicationDescription, List<String> applicationModules,
              List<InputDataObjectType> applicationInputs, List<OutputDataObjectType>applicationOutputs) {
         ApplicationInterfaceDescription applicationInterfaceDescription = new ApplicationInterfaceDescription();

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/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 9127fc9..db2965f 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
@@ -144,7 +144,7 @@ public class ComputeResourceRegister {
         return computeResourceId;
     }
 
-    public static ComputeResourceDescription createComputeResourceDescription(
+    public ComputeResourceDescription createComputeResourceDescription(
             String hostName, String hostDesc, List<String> hostAliases, List<String> ipAddresses) {
         ComputeResourceDescription host = new ComputeResourceDescription();
         host.setHostName(hostName);
@@ -154,7 +154,7 @@ public class ComputeResourceRegister {
         return host;
     }
 
-    public static ResourceJobManager createResourceJobManager(
+    public ResourceJobManager createResourceJobManager(
             ResourceJobManagerType resourceJobManagerType, String pushMonitoringEndpoint, String jobManagerBinPath,
             Map<JobManagerCommand, String> jobManagerCommands) {
         ResourceJobManager resourceJobManager = new ResourceJobManager();
@@ -197,8 +197,7 @@ public class ComputeResourceRegister {
         }
     }
 
-    public static ComputeResourcePreference
-    createComputeResourcePreference(String computeResourceId, String allocationProjectNumber,
+    public ComputeResourcePreference createComputeResourcePreference(String computeResourceId, String allocationProjectNumber,
                                     boolean overridebyAiravata, String preferredBatchQueue,
                                     JobSubmissionProtocol preferredJobSubmissionProtocol,
                                     DataMovementProtocol preferredDataMovementProtocol,

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
index b6b5476..7a79735 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
@@ -149,8 +149,6 @@ public class ExperimentExecution {
                 }
             });
         }
-
-
     }
 
     public void createAmberExperiment () throws Exception{

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
new file mode 100644
index 0000000..22a1608
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FrameworkBootstrapping {
+    private final static Logger logger = LoggerFactory.getLogger(FrameworkBootstrapping.class);
+
+    public static void main(String[] args) {
+        try {
+            FrameworkSetup setup = FrameworkSetup.getInstance();
+            setup.getGatewayRegister().createGateways();
+            logger.info("Gateways created...");
+            setup.getGatewayRegister().registerSSHKeys();
+            logger.info("Registered SSH keys to each gateway...");
+            setup.getApplicationRegister().addApplications();
+            logger.info("Applications registered for each each gateway...");
+        } catch (Exception e) {
+            logger.error("Error occured while set up", e);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
new file mode 100644
index 0000000..d0666e4
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.api.Airavata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FrameworkSetup {
+    private static FrameworkSetup instance = new FrameworkSetup();
+    private GatewayRegister gatewayRegister;
+    private ApplicationRegister applicationRegister;
+    private Airavata.Client airavata;
+    private final static Logger logger = LoggerFactory.getLogger(FrameworkSetup.class);
+
+    public static FrameworkSetup getInstance() {
+        return instance;
+    }
+
+    private FrameworkSetup() {
+        try {
+            AiravataClient airavataClient = AiravataClient.getInstance();
+            this.airavata = airavataClient.getAiravataClient();
+            gatewayRegister = new GatewayRegister(airavata);
+            applicationRegister = new ApplicationRegister(airavata);
+        } catch (Exception e) {
+            logger.error("Error while creating airavata client instance", e);
+        }
+    }
+
+    public GatewayRegister getGatewayRegister() {
+        return gatewayRegister;
+    }
+
+    public void setGatewayRegister(GatewayRegister gatewayRegister) {
+        this.gatewayRegister = gatewayRegister;
+    }
+
+    public ApplicationRegister getApplicationRegister() {
+        return applicationRegister;
+    }
+
+    public void setApplicationRegister(ApplicationRegister applicationRegister) {
+        this.applicationRegister = applicationRegister;
+    }
+
+    public Airavata.Client getAiravata() {
+        return airavata;
+    }
+
+    public void setAiravata(Airavata.Client airavata) {
+        this.airavata = airavata;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java
new file mode 100644
index 0000000..f0fba59
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java
@@ -0,0 +1,220 @@
+/*
+ *
+ * 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.api.Airavata;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
+import org.apache.airavata.credential.store.util.TokenGenerator;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.error.AiravataClientException;
+import org.apache.airavata.model.error.AiravataSystemException;
+import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GatewayRegister {
+    private final static Logger logger = LoggerFactory.getLogger(GatewayRegister.class);
+    private Airavata.Client airavata;
+    private PropertyReader propertyReader;
+    private int gatewayCount;
+    private Map<String, String> tokenMap;
+    private Map<String, String> projectMap;
+
+    public GatewayRegister(Airavata.Client client) throws Exception{
+        try {
+            this.airavata = client;
+            this.tokenMap = new HashMap<String, String>();
+            this.projectMap = new HashMap<String, String>();
+            propertyReader = new PropertyReader();
+        }catch (Exception e){
+            logger.error("Error while initializing setup step", e);
+            throw new Exception("Error while initializing setup step", e);
+        }
+
+    }
+
+    public void createGateways() throws Exception{
+        try {
+            // read gateway count from properties file
+            gatewayCount = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.NUMBER_OF_GATEWAYS, PropertyFileType.TEST_FRAMEWORK));
+            String genericGatewayName = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_NAME, PropertyFileType.TEST_FRAMEWORK);
+            String genericGatewayDomain = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_DOMAIN, PropertyFileType.TEST_FRAMEWORK);
+            for (int i = 0; i < gatewayCount; i++){
+                Gateway gateway = new Gateway();
+                String gatewayId = genericGatewayName + (i + 1);
+                gateway.setGatewayId(gatewayId);
+                gateway.setGatewayName(gatewayId);
+                gateway.setDomain(gatewayId + genericGatewayDomain);
+                airavata.addGateway(gateway);
+                GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
+                gatewayResourceProfile.setGatewayID(gatewayId);
+                airavata.registerGatewayResourceProfile(gatewayResourceProfile);
+                // create a project per each gateway
+                createProject(gatewayId);
+            }
+        } catch (AiravataSystemException e) {
+            logger.error("Error while creating airavata client instance", e);
+            throw new Exception("Error while creating airavata client instance", e);
+        } catch (InvalidRequestException e) {
+            logger.error("Invalid request for airavata client instance", e);
+            throw new Exception("Invalid request for airavata client instance", e);
+        } catch (AiravataClientException e) {
+            logger.error("Error while creating airavata client instance", e);
+            throw new Exception("Error while creating airavata client instance", e);
+        } catch (TException e) {
+            logger.error("Error while communicating with airavata client ", e);
+            throw new Exception("Error while communicating with airavata client", e);
+        }
+    }
+
+    public void createProject (String gatewayId) throws Exception{
+        Project project = new Project();
+        project.setName("testProj_" + gatewayId);
+        project.setOwner("testUser_" + gatewayId);
+        String projectId = airavata.createProject(gatewayId, project);
+        projectMap.put(projectId, gatewayId);
+    }
+
+    public void registerSSHKeys () throws Exception{
+        try {
+            // credential store related functions are not in the current api, so need to call credential store directly
+            AiravataUtils.setExecutionAsClient();
+            String jdbcURL = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_URL, PropertyFileType.AIRAVATA_CLIENT);
+            String jdbcDriver = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_DRIVER, PropertyFileType.AIRAVATA_CLIENT);
+            String userName = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_USERNAME, PropertyFileType.AIRAVATA_CLIENT);
+            String password = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_PWD, PropertyFileType.AIRAVATA_CLIENT);
+            String privateKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PRIKEY_LOCATION, PropertyFileType.TEST_FRAMEWORK);
+            String pubKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PUBKEY_LOCATION, PropertyFileType.TEST_FRAMEWORK);
+            String keyPassword = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PWD, PropertyFileType.TEST_FRAMEWORK);
+            DBUtil dbUtil = new DBUtil(jdbcURL, userName, password, jdbcDriver);
+            SSHCredentialWriter writer = new SSHCredentialWriter(dbUtil);
+            List<Gateway> allGateways = airavata.getAllGateways();
+            for (Gateway gateway : allGateways){
+                SSHCredential sshCredential = new SSHCredential();
+                sshCredential.setGateway(gateway.getGatewayId());
+                String token = TokenGenerator.generateToken(gateway.getGatewayId(), null);
+                sshCredential.setToken(token);
+                sshCredential.setPortalUserName("testuser");
+                FileInputStream privateKeyStream = new FileInputStream(privateKeyPath);
+                File filePri = new File(privateKeyPath);
+                byte[] bFilePri = new byte[(int) filePri.length()];
+                privateKeyStream.read(bFilePri);
+                FileInputStream pubKeyStream = new FileInputStream(pubKeyPath);
+                File filePub = new File(pubKeyPath);
+                byte[] bFilePub = new byte[(int) filePub.length()];
+                pubKeyStream.read(bFilePub);
+                privateKeyStream.close();
+                pubKeyStream.close();
+                sshCredential.setPrivateKey(bFilePri);
+                sshCredential.setPublicKey(bFilePub);
+                sshCredential.setPassphrase(keyPassword);
+                writer.writeCredentials(sshCredential);
+                tokenMap.put(gateway.getGatewayId(), token);
+            }
+        } catch (ClassNotFoundException e) {
+            logger.error("Unable to find mysql driver", e);
+            throw new Exception("Unable to find mysql driver",e);
+        } catch (InstantiationException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        } catch (IllegalAccessException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-client properties", e);
+            throw new Exception("Unable to read airavata-client properties",e);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (TException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (FileNotFoundException e) {
+            logger.error("Could not find keys specified in the path", e);
+            throw new Exception("Could not find keys specified in the path",e);
+        } catch (CredentialStoreException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        } catch (IOException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        }
+    }
+
+    public int getGatewayCount() {
+        return gatewayCount;
+    }
+
+    public void setGatewayCount(int gatewayCount) {
+        this.gatewayCount = gatewayCount;
+    }
+
+    public Map<String, String> getTokenMap() {
+        return tokenMap;
+    }
+
+    public void setTokenMap(Map<String, String> tokenMap) {
+        this.tokenMap = tokenMap;
+    }
+
+    public Map<String, String> getProjectMap() {
+        return projectMap;
+    }
+
+    public void setProjectMap(Map<String, String> projectMap) {
+        this.projectMap = projectMap;
+    }
+
+    public Airavata.Client getAiravata() {
+        return airavata;
+    }
+
+    public void setAiravata(Airavata.Client airavata) {
+        this.airavata = airavata;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
new file mode 100644
index 0000000..b27b429
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+public class LoadTester {
+    private final static Logger logger = LoggerFactory.getLogger(LoadTester.class);
+    public static void main(String[] args) {
+        try {
+            FrameworkSetup frameworkSetup = FrameworkSetup.getInstance();
+            Map<String, String> tokenMap = frameworkSetup.getGatewayRegister().getTokenMap();
+            Map<String, String> projectMap = frameworkSetup.getGatewayRegister().getProjectMap();
+            Map<String, String> appInterfaceMap = frameworkSetup.getApplicationRegister().getApplicationInterfaceListPerGateway();
+
+            ExperimentExecution experimentExecution = new ExperimentExecution(frameworkSetup.getAiravata(),tokenMap, appInterfaceMap, projectMap);
+            experimentExecution.createAmberExperiment();
+            experimentExecution.createEchoExperiment();
+            experimentExecution.launchExperiments();
+            experimentExecution.monitorExperiments();
+        } catch (Exception e) {
+            logger.error("Error while submitting experiments", e);
+        }
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
deleted file mode 100644
index 9b94d4e..0000000
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * 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.api.Airavata;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
-import org.apache.airavata.credential.store.util.TokenGenerator;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
-import org.apache.airavata.model.error.AiravataClientException;
-import org.apache.airavata.model.error.AiravataSystemException;
-import org.apache.airavata.model.error.InvalidRequestException;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType;
-import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader;
-import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
-import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Setup {
-    private final static Logger logger = LoggerFactory.getLogger(Setup.class);
-    private AiravataClient airavataClient;
-    private Airavata.Client airavata;
-    private PropertyReader propertyReader;
-    private int gatewayCount;
-    private Map<String, String> tokenMap;
-    private Map<String, String> projectMap;
-
-    public Setup() {
-        this.airavataClient = AiravataClient.getInstance();
-        this.airavata = airavataClient.getAiravataClient();
-        this.tokenMap = new HashMap<String, String>();
-        this.projectMap = new HashMap<String, String>();
-        propertyReader = new PropertyReader();
-    }
-
-    public void createGateways() throws Exception{
-        try {
-            // read gateway count from properties file
-            gatewayCount = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.NUMBER_OF_GATEWAYS, PropertyFileType.TEST_FRAMEWORK));
-            String genericGatewayName = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_NAME, PropertyFileType.TEST_FRAMEWORK);
-            String genericGatewayDomain = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_DOMAIN, PropertyFileType.TEST_FRAMEWORK);
-            for (int i = 0; i < gatewayCount; i++){
-                Gateway gateway = new Gateway();
-                String gatewayId = genericGatewayName + (i + 1);
-                gateway.setGatewayId(gatewayId);
-                gateway.setGatewayName(gatewayId);
-                gateway.setDomain(gatewayId + genericGatewayDomain);
-                airavata.addGateway(gateway);
-                GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
-                gatewayResourceProfile.setGatewayID(gatewayId);
-                airavata.registerGatewayResourceProfile(gatewayResourceProfile);
-                // create a project per each gateway
-                createProject(gatewayId);
-            }
-        } catch (AiravataSystemException e) {
-            logger.error("Error while creating airavata client instance", e);
-            throw new Exception("Error while creating airavata client instance", e);
-        } catch (InvalidRequestException e) {
-            logger.error("Invalid request for airavata client instance", e);
-            throw new Exception("Invalid request for airavata client instance", e);
-        } catch (AiravataClientException e) {
-            logger.error("Error while creating airavata client instance", e);
-            throw new Exception("Error while creating airavata client instance", e);
-        } catch (TException e) {
-            logger.error("Error while communicating with airavata client ", e);
-            throw new Exception("Error while communicating with airavata client", e);
-        }
-    }
-
-    public void createProject (String gatewayId) throws Exception{
-        Project project = new Project();
-        project.setName("testProj_" + gatewayId);
-        project.setOwner("testUser_" + gatewayId);
-        String projectId = airavata.createProject(gatewayId, project);
-        projectMap.put(projectId, gatewayId);
-    }
-
-    public void registerSSHKeys () throws Exception{
-        try {
-            // credential store related functions are not in the current api, so need to call credential store directly
-            AiravataUtils.setExecutionAsClient();
-            String jdbcURL = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_URL, PropertyFileType.AIRAVATA_CLIENT);
-            String jdbcDriver = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_DRIVER, PropertyFileType.AIRAVATA_CLIENT);
-            String userName = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_USERNAME, PropertyFileType.AIRAVATA_CLIENT);
-            String password = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_PWD, PropertyFileType.AIRAVATA_CLIENT);
-            String privateKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PRIKEY_LOCATION, PropertyFileType.TEST_FRAMEWORK);
-            String pubKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PUBKEY_LOCATION, PropertyFileType.TEST_FRAMEWORK);
-            String keyPassword = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PWD, PropertyFileType.TEST_FRAMEWORK);
-            DBUtil dbUtil = new DBUtil(jdbcURL, userName, password, jdbcDriver);
-            SSHCredentialWriter writer = new SSHCredentialWriter(dbUtil);
-            List<Gateway> allGateways = airavata.getAllGateways();
-            for (Gateway gateway : allGateways){
-                SSHCredential sshCredential = new SSHCredential();
-                sshCredential.setGateway(gateway.getGatewayId());
-                String token = TokenGenerator.generateToken(gateway.getGatewayId(), null);
-                sshCredential.setToken(token);
-                sshCredential.setPortalUserName("testuser");
-                FileInputStream privateKeyStream = new FileInputStream(privateKeyPath);
-                File filePri = new File(privateKeyPath);
-                byte[] bFilePri = new byte[(int) filePri.length()];
-                privateKeyStream.read(bFilePri);
-                FileInputStream pubKeyStream = new FileInputStream(pubKeyPath);
-                File filePub = new File(pubKeyPath);
-                byte[] bFilePub = new byte[(int) filePub.length()];
-                pubKeyStream.read(bFilePub);
-                privateKeyStream.close();
-                pubKeyStream.close();
-                sshCredential.setPrivateKey(bFilePri);
-                sshCredential.setPublicKey(bFilePub);
-                sshCredential.setPassphrase(keyPassword);
-                writer.writeCredentials(sshCredential);
-                tokenMap.put(gateway.getGatewayId(), token);
-            }
-        } catch (ClassNotFoundException e) {
-            logger.error("Unable to find mysql driver", e);
-            throw new Exception("Unable to find mysql driver",e);
-        } catch (InstantiationException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        } catch (IllegalAccessException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read airavata-client properties", e);
-            throw new Exception("Unable to read airavata-client properties",e);
-        } catch (AiravataSystemException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (InvalidRequestException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (AiravataClientException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (TException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (FileNotFoundException e) {
-            logger.error("Could not find keys specified in the path", e);
-            throw new Exception("Could not find keys specified in the path",e);
-        } catch (CredentialStoreException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        } catch (IOException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        }
-    }
-
-    public int getGatewayCount() {
-        return gatewayCount;
-    }
-
-    public void setGatewayCount(int gatewayCount) {
-        this.gatewayCount = gatewayCount;
-    }
-
-    public Map<String, String> getTokenMap() {
-        return tokenMap;
-    }
-
-    public void setTokenMap(Map<String, String> tokenMap) {
-        this.tokenMap = tokenMap;
-    }
-
-    public Map<String, String> getProjectMap() {
-        return projectMap;
-    }
-
-    public void setProjectMap(Map<String, String> projectMap) {
-        this.projectMap = projectMap;
-    }
-}


[02/11] airavata git commit: fixing AIRAVATA-1567

Posted by sh...@apache.org.
fixing AIRAVATA-1567


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d798cab5
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d798cab5
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d798cab5

Branch: refs/heads/emailMonitoring
Commit: d798cab5209a093d1f08eac591626d10ace13e14
Parents: a8cf35f
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Tue Mar 31 10:22:40 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Tue Mar 31 10:22:40 2015 -0400

----------------------------------------------------------------------
 .../airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java      | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/d798cab5/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index f0b447e..ab934ca 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -195,6 +195,8 @@ public class HPCPullMonitor extends PullMonitor {
                                 logger.info("Job cancelled: marking the Job as ************CANCELLED************ experiment {}, task {}, job name {} .",
                                         iMonitorID.getExperimentID(), iMonitorID.getTaskID(), iMonitorID.getJobName());
                                 sendNotification(iMonitorID);
+                                logger.info("To avoid timing issues we sleep sometime and try to retrieve output files");
+                                Thread.sleep(10000);
                                 GFacThreadPoolExecutor.getFixedThreadPool().submit(new OutHandlerWorker(gfac, iMonitorID, publisher));
                                 break;
                             }


[06/11] airavata git commit: fixed a bug in app catalog mysql script

Posted by sh...@apache.org.
fixed a bug in app catalog mysql script


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/26cf7edd
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/26cf7edd
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/26cf7edd

Branch: refs/heads/emailMonitoring
Commit: 26cf7edd45dac3909f5caf27ca6f93e9369bb8d4
Parents: 1f9ac84
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Mar 31 17:16:06 2015 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Mar 31 17:16:06 2015 -0400

----------------------------------------------------------------------
 .../app-catalog-data/src/main/resources/appcatalog-mysql.sql     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/26cf7edd/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
index cfb8022..2dcc119 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
@@ -244,7 +244,7 @@ CREATE TABLE PREJOB_COMMAND
          APPDEPLOYMENT_ID VARCHAR(255),
          COMMAND VARCHAR(255),
          PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
-         FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(APPDEPLOYMENT_ID) ON DELETE CASCADE
+         FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
 );
 
 CREATE TABLE POSTJOB_COMMAND
@@ -252,7 +252,7 @@ CREATE TABLE POSTJOB_COMMAND
          APPLICATION_DEPLOYMENT VARCHAR(255),
          COMMAND VARCHAR(255),
          PRIMARY KEY(APPLICATION_DEPLOYMENT, COMMAND),
-         FOREIGN KEY (APPLICATION_DEPLOYMENT) REFERENCES APPLICATION_DEPLOYMENT(APPLICATION_DEPLOYMENT) ON DELETE CASCADE
+         FOREIGN KEY (APPLICATION_DEPLOYMENT) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
 );
 
 CREATE TABLE APPLICATION_INTERFACE