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

git commit: Adding the missing gateway profile CPI methods

Repository: airavata
Updated Branches:
  refs/heads/master c290a0444 -> 0d4a7d1da


Adding the missing gateway profile CPI methods


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

Branch: refs/heads/master
Commit: 0d4a7d1da618c2f7847cdd5daf50b36d9ec72908
Parents: c290a04
Author: Suresh Marru <sm...@apache.org>
Authored: Mon Jul 7 09:30:22 2014 -0400
Committer: Suresh Marru <sm...@apache.org>
Committed: Mon Jul 7 09:30:22 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |  8 +--
 .../airavataAPI.thrift                          |  2 +-
 .../applicationInterfaceModel.thrift            |  2 +-
 .../appcatalog/cpi/GwyResourceProfile.java      | 42 ++++++------
 .../data/impl/GwyResourceProfileImpl.java       | 68 +++++++-------------
 .../gfac.cpi.service.thrift                     |  7 +-
 .../orchestrator.cpi.service.thrift             |  2 +-
 7 files changed, 56 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/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 104d4dc..9fcd5c2 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
@@ -1998,7 +1998,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
     	try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            gatewayProfile.addGatewayProfile(gatewayResourceProfile);
+            gatewayProfile.addGatewayResourceProfile(gatewayResourceProfile);
             return true;
         } catch (AppCatalogException e) {
             logger.error("Error while registering gateway resource profile...", e);
@@ -2044,7 +2044,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
     	try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            gatewayProfile.updateGatewayProfile(gatewayID, gatewayResourceProfile);
+            gatewayProfile.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
             return true;
         } catch (AppCatalogException e) {
             logger.error("Error while updating gateway resource profile...", e);
@@ -2067,7 +2067,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
     	try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            gatewayProfile.removeGatewayProfile(gatewayID);
+            gatewayProfile.removeGatewayResourceProfile(gatewayID);
             return true;
         } catch (AppCatalogException e) {
             logger.error("Error while removing gateway resource profile...", e);
@@ -2095,7 +2095,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
             GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
             profile.addToComputeResourcePreferences(computeResourcePreference);
-            gatewayProfile.updateGatewayProfile(gatewayID, profile);
+            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
             return true;
         } catch (AppCatalogException e) {
             logger.error("Error while registering gateway resource profile...", e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
----------------------------------------------------------------------
diff --git a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
index b5cd0cd..6b43848 100644
--- a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
+++ b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
@@ -54,7 +54,7 @@ namespace js AiravataAPI
  *              in a change to major/minor version numbers.
  *
 */
-const string AIRAVATA_API_VERSION = "0.12.0"
+const string AIRAVATA_API_VERSION = "0.13.0"
 
 service Airavata {
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/airavata-api/thrift-interface-descriptions/applicationInterfaceModel.thrift
----------------------------------------------------------------------
diff --git a/airavata-api/thrift-interface-descriptions/applicationInterfaceModel.thrift b/airavata-api/thrift-interface-descriptions/applicationInterfaceModel.thrift
index 0419827..01345aa 100644
--- a/airavata-api/thrift-interface-descriptions/applicationInterfaceModel.thrift
+++ b/airavata-api/thrift-interface-descriptions/applicationInterfaceModel.thrift
@@ -117,7 +117,7 @@ struct OutputDataObjectType {
  * appDeploymentId:
  *   Corelated the interface to a particular application deployment
  *
- *
+ * FIXME: add a description
 */
 struct ApplicationInterfaceDescription {
     1: required bool isEmpty = 0,

http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
index c3b42e4..95b8614 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
@@ -2,22 +2,25 @@ package org.airavata.appcatalog.cpi;
 
 import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol;
 import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 
+import java.util.List;
+
 public interface GwyResourceProfile {
     /**
      * This method will add a gateway profile
      * @param gatewayProfile gateway profile
      * @return gateway id
      */
-    String addGatewayProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException;
+    String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException;
 
     /**
      * This method will update a gateway profile
      * @param gatewayId unique gateway id
      * @param updatedProfile updated profile
      */
-    void updateGatewayProfile (String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException;
+    void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException;
 
     /**
      *
@@ -27,34 +30,31 @@ public interface GwyResourceProfile {
     org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile getGatewayProfile (String gatewayId) throws AppCatalogException;
 
     /**
-     *
-     * @param gatewayId
-     * @param hostId
-     * @return
-     */
-    JobSubmissionProtocol getPreferedJobSubmissionProtocol (String gatewayId, String hostId) throws AppCatalogException;
-
-    /**
-     *
-     * @param gatewayId
-     * @param hostId
-     * @return
-     */
-    DataMovementProtocol getPreferedDMProtocol (String gatewayId, String hostId) throws AppCatalogException;
-
-
-    /**
      * This method will remove a gateway profile
      * @param gatewayId unique gateway id
      * @return true or false
      */
-    boolean removeGatewayProfile (String gatewayId) throws AppCatalogException;
+    boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException;
 
     /**
      * This method will check whether gateway profile exists
      * @param gatewayId unique gateway id
      * @return true or false
      */
-    boolean isGatewayProfileExists (String gatewayId) throws AppCatalogException;
+    boolean isGatewayResourceProfileExists(String gatewayId) throws AppCatalogException;
 
+    /**
+     *
+     * @param gatewayId
+     * @param hostId
+     * @return ComputeResourcePreference
+     */
+    ComputeResourcePreference getComputeResourcePreference (String gatewayId, String hostId) throws AppCatalogException;
+
+    /**
+     *
+     * @param gatewayId
+     * @return
+     */
+    List<ComputeResourcePreference> getAllComputeResourcePreferences (String gatewayId) throws AppCatalogException;
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
index cf4eb4f..8410c3b 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
@@ -40,7 +40,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
     private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileImpl.class);
 
     @Override
-    public String addGatewayProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException {
+    public String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException {
         try {
             GatewayProfileResource profileResource = new GatewayProfileResource();
             profileResource.setGatewayName(gatewayProfile.getGatewayName());
@@ -74,7 +74,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
     }
 
     @Override
-    public void updateGatewayProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
+    public void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
         try {
             GatewayProfileResource profileResource = new GatewayProfileResource();
             GatewayProfileResource existingGP = (GatewayProfileResource)profileResource.get(gatewayId);
@@ -127,48 +127,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
     }
 
     @Override
-    public JobSubmissionProtocol getPreferedJobSubmissionProtocol(String gatewayId, String hostId) throws AppCatalogException{
-        try {
-            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
-            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
-            if (computePrefList != null && !computePrefList.isEmpty()){
-                for (Resource pref : computePrefList){
-                    ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource)pref;
-                    if (preferenceResource.getResourceId().equals(hostId)){
-                        return JobSubmissionProtocol.valueOf(preferenceResource.getPreferredJobProtocol());
-                    }
-                }
-            }
-        }catch (Exception e) {
-            logger.error("Error while retrieving job submission protocol for given host and gateway...", e);
-            throw new AppCatalogException(e);
-        }
-        return null;
-    }
-
-    @Override
-    public DataMovementProtocol getPreferedDMProtocol(String gatewayId, String hostId) throws AppCatalogException{
-        try {
-            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
-            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
-            if (computePrefList != null && !computePrefList.isEmpty()){
-                for (Resource pref : computePrefList){
-                    ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource)pref;
-                    if (preferenceResource.getResourceId().equals(hostId)){
-                        return DataMovementProtocol.valueOf(preferenceResource.getPreferedDMProtocol());
-                    }
-                }
-            }
-        }catch (Exception e) {
-            logger.error("Error while retrieving data movement protocol for given host and gateway...", e);
-            throw new AppCatalogException(e);
-        }
-        return null;
-    }
-
-
-    @Override
-    public boolean removeGatewayProfile(String gatewayId) throws AppCatalogException {
+    public boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException {
        try {
            GatewayProfileResource resource = new GatewayProfileResource();
            resource.remove(gatewayId);
@@ -180,7 +139,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
     }
 
     @Override
-    public boolean isGatewayProfileExists(String gatewayId) throws AppCatalogException {
+    public boolean isGatewayResourceProfileExists(String gatewayId) throws AppCatalogException {
         try {
             GatewayProfileResource resource = new GatewayProfileResource();
             return resource.isExists(gatewayId);
@@ -189,4 +148,23 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
             throw new AppCatalogException(e);
         }
     }
+
+    /**
+     * @param gatewayId
+     * @param hostId
+     * @return ComputeResourcePreference
+     */
+    @Override
+    public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) throws AppCatalogException {
+        return null;
+    }
+
+    /**
+     * @param gatewayId
+     * @return
+     */
+    @Override
+    public List<ComputeResourcePreference> getAllComputeResourcePreferences(String gatewayId) throws AppCatalogException {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift b/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
index 3e81148..3c3fa51 100644
--- a/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
+++ b/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
@@ -25,7 +25,7 @@
 
 namespace java org.apache.airavata.gfac.cpi
 
-const string GFAC_CPI_VERSION = "0.12.0"
+const string GFAC_CPI_VERSION = "0.13.0"
 
 service GfacService {
 
@@ -39,11 +39,14 @@ service GfacService {
      *
      * @param experimentID
      * @param taskID
+     * @param gatewayId:
+     *  The GatewayId is inferred from security context and passed onto gfac.
      * @return sucess/failure
      *
     **/
   bool submitJob (1: required string experimentId,
-                  2: required string taskId)
+                  2: required string taskId
+                  3: required string gatewayId)
 
     /**
      *

http://git-wip-us.apache.org/repos/asf/airavata/blob/0d4a7d1d/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift b/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
index 8dc91c9..781410c 100644
--- a/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
+++ b/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
@@ -26,7 +26,7 @@
 include "../../../airavata-api/thrift-interface-descriptions/airavataErrors.thrift"
 namespace java org.apache.airavata.orchestrator.cpi
 
-const string ORCHESTRATOR_CPI_VERSION = "0.12.0"
+const string ORCHESTRATOR_CPI_VERSION = "0.13.0"
 
 service OrchestratorService {