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

git commit: retrieve gateway id from the gateway name and use that to retrieve the preferences for the computeResource

Repository: airavata
Updated Branches:
  refs/heads/master 5d6cb2911 -> a34c0d9f2


retrieve gateway id from the gateway name and use that to retrieve the preferences for the computeResource


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

Branch: refs/heads/master
Commit: a34c0d9f2caf77b2b58ea00641db7fa36f3ec86f
Parents: 5d6cb29
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Tue Jul 8 13:41:57 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Tue Jul 8 13:41:57 2014 -0400

----------------------------------------------------------------------
 .../airavata/gfac/core/cpi/BetterGfacImpl.java  | 27 +++++++++++++-------
 1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/a34c0d9f/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 397247f..e5fe41e 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
@@ -253,10 +253,18 @@ public class BetterGfacImpl implements GFac {
                 getApplicationDeployment().getApplicationDeployement(applicationDeploymentId);
 		ComputeResourceDescription computeResource = appCatalog.getComputeResource().
                 getComputeResource(applicationDeployment.getComputeHostId());
-        ComputeResourcePreference gatewayResourcePreferences = appCatalog.getGatewayProfile().
-                        getComputeResourcePreference(gatewayID, applicationDeployment.getComputeHostId());
-
-        //Create the legacy schema docs to fill-in
+		ComputeResourcePreference gatewayResourcePreferences = appCatalog.getGatewayProfile().
+                getComputeResourcePreference(gatewayID, applicationDeployment.getComputeHostId());
+		if (gatewayResourcePreferences==null) {
+			List<String> gatewayProfileIds = appCatalog.getGatewayProfile()
+					.getGatewayProfileIds(gatewayID);
+			if (gatewayProfileIds.size()>0){
+				gatewayID=gatewayProfileIds.get(0);
+				gatewayResourcePreferences = appCatalog.getGatewayProfile().
+		                getComputeResourcePreference(gatewayID, applicationDeployment.getComputeHostId());
+			}
+		}
+		//Create the legacy schema docs to fill-in
         ServiceDescription legacyServiceDescription = new ServiceDescription();
         ServiceDescriptionType legacyServiceDescType = legacyServiceDescription.getType();
         ApplicationDescription legacyAppDescription = new ApplicationDescription();
@@ -382,11 +390,12 @@ public class BetterGfacImpl implements GFac {
 			 ProjectAccountType projectAccountType = legacyHPCAppDescType.addNewProjectAccount();
 			projectAccountType.setProjectAccountNumber(gatewayResourcePreferences.getAllocationProjectNumber());
         }
-        legacyAppDescType.setScratchWorkingDirectory(gatewayResourcePreferences.getScratchLocation());
-        //Fetch from gateway profile
-
-        //hostDescription.getType().setHostAddress(computeResource.getIpAddresses().iterator().next());
-        
+		if (gatewayResourcePreferences!=null){
+			legacyAppDescType.setScratchWorkingDirectory(gatewayResourcePreferences.getScratchLocation());
+		}else{
+			legacyAppDescType.setScratchWorkingDirectory("/tmp");
+			log.warn("gateway resource profile for gateway id '"+gatewayID+"'.");
+		}
 		
         URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
         Properties configurationProperties = ServerSettings.getProperties();