You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/07/07 21:39:33 UTC

git commit: module load comands

Repository: airavata
Updated Branches:
  refs/heads/master 07e6009b1 -> d9df54175


module load comands


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

Branch: refs/heads/master
Commit: d9df541750987e0d9207790bb95d81e383eee333
Parents: 07e6009
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Mon Jul 7 15:39:27 2014 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Mon Jul 7 15:39:27 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 18 +++++++++++-
 .../data/impl/ApplicationDeploymentImpl.java    | 30 ++++++++++++++++----
 .../app/catalog/test/AppDeploymentTest.java     |  1 +
 3 files changed, 42 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/d9df5417/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 5246518..bd4abd8 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -1630,7 +1630,23 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
      */
     @Override
     public Map<String, String> getAllComputeResourceNames() throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-        return null;
+        try {
+            appCatalog = AppCatalogFactory.getAppCatalog();
+            List<ComputeResourceDescription> allComputeResourceList = appCatalog.getComputeResource().getAllComputeResourceList();
+            if (allComputeResourceList != null && !allComputeResourceList.isEmpty()){
+                Map<String, String> allComputeResources = new HashMap<String, String>();
+                for (ComputeResourceDescription resourceDescription : allComputeResourceList){
+                    allComputeResources.put(resourceDescription.getComputeResourceId(), resourceDescription.getHostName());
+                }
+                return allComputeResources;
+            }
+        } catch (AppCatalogException e) {
+            logger.error("Error while retrieving compute resource...", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while retrieving compute resource. More info : " + e.getMessage());
+            throw exception;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9df5417/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
index 2c33c67..3ae16c9 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
@@ -65,12 +65,19 @@ public class ApplicationDeploymentImpl implements ApplicationDeployment {
             if (parallelism != null){
                 deploymentResource.setParallelism(parallelism.toString());
             }
-
-            //TODO
-//            deploymentResource.setEnvModuleLoadCMD(deploymentDescription.getModuleLoadCmd());
             deploymentResource.save();
             deploymentDescription.setAppDeploymentId(deploymentResource.getDeploymentId());
 
+            List<String> moduleLoadCmds = deploymentDescription.getModuleLoadCmds();
+            if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+                for (String cmd : moduleLoadCmds){
+                    ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
+                    cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
+                    cmdResource.setCmd(cmd);
+                    cmdResource.save();
+                }
+            }
+
             List<SetEnvPaths> libPrependPaths = deploymentDescription.getLibPrependPaths();
             if (libPrependPaths != null && !libPrependPaths.isEmpty()){
                 for (SetEnvPaths path : libPrependPaths){
@@ -137,11 +144,22 @@ public class ApplicationDeploymentImpl implements ApplicationDeployment {
             if (updatedDeployment.getParallelism() != null){
                 deploymentResource.setParallelism(updatedDeployment.getParallelism().toString());
             }
-            //TODO
-            
-//            existingDep.setEnvModuleLoadCMD(updatedDeployment.getModuleLoadCmd());
+
             existingDep.save();
 
+            List<String> moduleLoadCmds = updatedDeployment.getModuleLoadCmds();
+            if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+                for (String cmd : moduleLoadCmds){
+                    ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
+                    Map<String, String> ids = new HashMap<String, String>();
+                    ids.put(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
+                    ids.put(AbstractResource.ModuleLoadCmdConstants.CMD, cmd);
+                    ModuleLoadCmdResource existingModuleLoad = (ModuleLoadCmdResource)cmdResource.get(ids);
+                    existingModuleLoad.setCmd(cmd);
+                    existingModuleLoad.setAppDeploymentResource(existingDep);
+                    existingModuleLoad.save();
+                }
+            }
             List<SetEnvPaths> libPrependPaths = updatedDeployment.getLibPrependPaths();
             if (libPrependPaths != null && !libPrependPaths.isEmpty()){
                 for (SetEnvPaths path : libPrependPaths){

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9df5417/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
index 1b38af1..1f1d29e 100644
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
@@ -87,6 +87,7 @@ public class AppDeploymentTest {
         description.setComputeHostId(hostId);
         description.setExecutablePath("/home/a/b/c");
         description.setAppDeploymentDescription("test app deployment");
+        description.addToModuleLoadCmds("");
         //TODO
 //        description.setModuleLoadCmd("module load");?
         List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>();