airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata git commit: return only the enabled compute resources for application Airavata 1753
Date Fri, 10 Jul 2015 19:39:30 GMT
Repository: airavata
Updated Branches:
  refs/heads/airavata-0.15-release-branch 618b70804 -> 595724592


return only the enabled compute resources for application Airavata 1753


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

Branch: refs/heads/airavata-0.15-release-branch
Commit: 59572459253612ee606b3af05aae11842b6cd129
Parents: 618b708
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Sat Jul 11 01:07:44 2015 +0530
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Sat Jul 11 01:07:44 2015 +0530

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |  7 +++--
 .../appcatalog/cpi/ComputeResource.java         | 10 +++++--
 .../catalog/data/impl/ComputeResourceImpl.java  | 29 ++++++++++++++++++--
 3 files changed, 39 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/59572459/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 9d48bfe..04505d2 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
@@ -2314,7 +2314,8 @@ public class AiravataServerHandler implements Airavata.Iface {
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             ApplicationDeployment applicationDeployment = appCatalog.getApplicationDeployment();
-            Map<String, String> allComputeResources = appCatalog.getComputeResource().getAllComputeResourceIdList();
+            Map<String, String> availableComputeResourceIdList = appCatalog.getComputeResource()
+                    .getAvailableComputeResourceIdList();
             Map<String, String> availableComputeResources = new HashMap<String,
String>();
             ApplicationInterfaceDescription applicationInterface =
                     appCatalog.getApplicationInterface().getApplicationInterface(appInterfaceId);
@@ -2326,9 +2327,9 @@ public class AiravataServerHandler implements Airavata.Iface {
                     List<ApplicationDeploymentDescription> applicationDeployments =
                             applicationDeployment.getApplicationDeployements(filters);
                     for (ApplicationDeploymentDescription deploymentDescription : applicationDeployments)
{
-                        if (allComputeResources.get(deploymentDescription.getComputeHostId())
!= null){
+                        if (availableComputeResourceIdList.get(deploymentDescription.getComputeHostId())
!= null){
                             availableComputeResources.put(deploymentDescription.getComputeHostId(),
-                                    allComputeResources.get(deploymentDescription.getComputeHostId()));
+                                    availableComputeResourceIdList.get(deploymentDescription.getComputeHostId()));
                         }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/59572459/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
index c17da17..1a87ab3 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
@@ -19,11 +19,11 @@
 
 package org.airavata.appcatalog.cpi;
 
+import org.apache.airavata.model.appcatalog.computeresource.*;
+
 import java.util.List;
 import java.util.Map;
 
-import org.apache.airavata.model.appcatalog.computeresource.*;
-
 public interface ComputeResource {
     /**
      * This function will add a compute resource description to the database
@@ -138,6 +138,12 @@ public interface ComputeResource {
      */
     Map<String, String> getAllComputeResourceIdList () throws AppCatalogException;
 
+    /**
+     * This method will retrieve only the enabled the compute resource id with it's name
+     * @return map of compute resource ids + name
+     * @throws AppCatalogException
+     */
+    Map<String, String> getAvailableComputeResourceIdList () throws AppCatalogException;
 
 
 //    /**

http://git-wip-us.apache.org/repos/asf/airavata/blob/59572459/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
index 11ba727..40b3210 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
@@ -21,8 +21,6 @@
 
 package org.apache.aiaravata.application.catalog.data.impl;
 
-import java.util.*;
-
 import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.airavata.appcatalog.cpi.ComputeResource;
 import org.apache.aiaravata.application.catalog.data.resources.*;
@@ -32,6 +30,11 @@ import org.apache.airavata.model.appcatalog.computeresource.*;
 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 ComputeResourceImpl implements ComputeResource {
     private final static Logger logger = LoggerFactory.getLogger(ComputeResourceImpl.class);
 
@@ -473,6 +476,28 @@ public class ComputeResourceImpl implements ComputeResource {
         }
     }
 
+    @Override
+    public Map<String, String> getAvailableComputeResourceIdList() throws AppCatalogException
{
+        try {
+            Map<String, String> computeResourceMap = new HashMap<String, String>();
+            ComputeResourceResource resource = new ComputeResourceResource();
+            List<Resource> allComputeResources = resource.getAll();
+            if (allComputeResources != null && !allComputeResources.isEmpty()){
+                for (Resource cm : allComputeResources){
+                    ComputeResourceResource cmr = (ComputeResourceResource)cm;
+                    if(cmr.isEnabled()) {
+                        computeResourceMap.put(cmr.getResourceId(), cmr.getHostName());
+                    }
+                }
+            }
+            return computeResourceMap;
+        }catch (Exception e){
+            logger.error("Error while retrieving compute resource list...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+
 //    @Override
 //    public GSISSHJobSubmission getGSISSHJobSubmission(String submissionId) throws AppCatalogException
{
 //        try {


Mime
View raw message