airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: give precedence to userconfiguration data, fixed AIRAVATA-2140
Date Tue, 04 Oct 2016 20:55:54 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop 04045c4ff -> 9b66d6792


give precedence to userconfiguration data, fixed AIRAVATA-2140


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

Branch: refs/heads/develop
Commit: 9b66d6792d0e063018db9cb58deb293eaef04c66
Parents: 04045c4
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Tue Oct 4 16:55:33 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Tue Oct 4 16:55:33 2016 -0400

----------------------------------------------------------------------
 .../org/apache/airavata/gfac/core/GFacUtils.java | 19 ++++++++++++++++---
 .../airavata/gfac/impl/GFacEngineImpl.java       |  5 +++++
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9b66d679/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
index 18c3515..fe9fd01 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
@@ -432,7 +432,7 @@ public class GFacUtils {
         groovyMap.add(Script.STANDARD_ERROR_FILE, processContext.getStderrLocation());
 
         ComputeResourcePreference crp = getComputeResourcePreference(processContext);
-        if (crp.getAllocationProjectNumber() != null) {
+        if (isValid(crp.getAllocationProjectNumber())) {
             groovyMap.add(Script.ACCOUNT_STRING, crp.getAllocationProjectNumber());
         }
         groovyMap.add(Script.RESERVATION, getReservation(crp));
@@ -458,12 +458,13 @@ public class GFacUtils {
             log.error("Error while getting job submissiont sub task model", e);
         }
 
+        // NOTE: Give precedence to data comes with experiment
         ComputationalResourceSchedulingModel scheduling = processModel.getProcessResourceSchedule();
         if (scheduling != null) {
             int totalNodeCount = scheduling.getNodeCount();
             int totalCPUCount = scheduling.getTotalCPUCount();
 
-            if (scheduling.getQueueName() != null) {
+            if (isValid(scheduling.getQueueName())) {
                 groovyMap.add(Script.QUEUE_NAME, scheduling.getQueueName());
             }
             if (totalNodeCount > 0) {
@@ -492,7 +493,16 @@ public class GFacUtils {
                 }
             }
             if (scheduling.getTotalPhysicalMemory() > 0) {
-                groovyMap.add(Script.USED_MEM, scheduling.getTotalPhysicalMemory() + "");
+                groovyMap.add(Script.USED_MEM, scheduling.getTotalPhysicalMemory());
+            }
+            if (isValid(scheduling.getOverrideLoginUserName())) {
+                groovyMap.add(Script.USER_NAME, scheduling.getOverrideLoginUserName());
+            }
+            if (isValid(scheduling.getOverrideAllocationProjectNumber())) {
+                groovyMap.add(Script.ACCOUNT_STRING, scheduling.getOverrideAllocationProjectNumber());
+            }
+            if (isValid(scheduling.getStaticWorkingDir())) {
+                groovyMap.add(Script.WORKING_DIR, scheduling.getStaticWorkingDir());
             }
         } else {
             log.error("Task scheduling cannot be null at this point..");
@@ -543,6 +553,9 @@ public class GFacUtils {
         return groovyMap;
     }
 
+    private static boolean isValid(String str) {
+        return str != null && !str.isEmpty();
+    }
     private static void setMailAddresses(ProcessContext processContext, GroovyMap groovyMap)
             throws GFacException, AppCatalogException, ApplicationSettingsException {
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/9b66d679/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
index 51a97c1..b973a20 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
@@ -80,6 +80,8 @@ public class GFacEngineImpl implements GFacEngine {
     @Override
     public ProcessContext populateProcessContext(String processId, String gatewayId, String
             tokenId) throws GFacException {
+
+        // NOTE: Process context gives precedence to data come with process Computer resources;
         ProcessContext processContext = new ProcessContext(processId, gatewayId, tokenId);
         try {
             AppCatalog appCatalog = Factory.getDefaultAppCatalog();
@@ -195,6 +197,9 @@ public class GFacEngineImpl implements GFacEngine {
                 }
                 processContext.setJobModel(((JobModel) jobModels.get(0)));
             }
+
+
+
             return processContext;
         } catch (AppCatalogException e) {
             String msg = "App catalog access exception ";


Mime
View raw message