[ 
https://issues.apache.org/jira/browse/AIRAVATA-2696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16393762#comment-16393762
 ] 

ASF GitHub Bot commented on AIRAVATA-2696:
------------------------------------------

machristie closed pull request #179: [AIRAVATA-2696] Add GroupResourceProfile 
to ProcessModel
URL: https://github.com/apache/airavata/pull/179
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/process/ProcessModel.java
 
b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/process/ProcessModel.java
index d6034ff9a8..514a7250f7 100644
--- 
a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/process/ProcessModel.java
+++ 
b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/process/ProcessModel.java
@@ -61,6 +61,7 @@
   private static final org.apache.thrift.protocol.TField 
EXPERIMENT_DATA_DIR_FIELD_DESC = new 
org.apache.thrift.protocol.TField("experimentDataDir", 
org.apache.thrift.protocol.TType.STRING, (short)22);
   private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC 
= new org.apache.thrift.protocol.TField("userName", 
org.apache.thrift.protocol.TType.STRING, (short)23);
   private static final org.apache.thrift.protocol.TField 
USE_USER_CRPREF_FIELD_DESC = new 
org.apache.thrift.protocol.TField("useUserCRPref", 
org.apache.thrift.protocol.TType.BOOL, (short)24);
+  private static final org.apache.thrift.protocol.TField 
GROUP_RESOURCE_PROFILE_ID_FIELD_DESC = new 
org.apache.thrift.protocol.TField("groupResourceProfileId", 
org.apache.thrift.protocol.TType.STRING, (short)25);
 
   private static final org.apache.thrift.scheme.SchemeFactory 
STANDARD_SCHEME_FACTORY = new ProcessModelStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory 
TUPLE_SCHEME_FACTORY = new ProcessModelTupleSchemeFactory();
@@ -89,6 +90,7 @@
   private java.lang.String experimentDataDir; // optional
   private java.lang.String userName; // optional
   private boolean useUserCRPref; // optional
+  private java.lang.String groupResourceProfileId; // optional
 
   /** The set of fields this struct contains, along with convenience methods 
for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -115,7 +117,8 @@
     GENERATE_CERT((short)21, "generateCert"),
     EXPERIMENT_DATA_DIR((short)22, "experimentDataDir"),
     USER_NAME((short)23, "userName"),
-    USE_USER_CRPREF((short)24, "useUserCRPref");
+    USE_USER_CRPREF((short)24, "useUserCRPref"),
+    GROUP_RESOURCE_PROFILE_ID((short)25, "groupResourceProfileId");
 
     private static final java.util.Map<java.lang.String, _Fields> byName = new 
java.util.HashMap<java.lang.String, _Fields>();
 
@@ -178,6 +181,8 @@ public static _Fields findByThriftId(int fieldId) {
           return USER_NAME;
         case 24: // USE_USER_CRPREF
           return USE_USER_CRPREF;
+        case 25: // GROUP_RESOURCE_PROFILE_ID
+          return GROUP_RESOURCE_PROFILE_ID;
         default:
           return null;
       }
@@ -224,7 +229,7 @@ public short getThriftFieldId() {
   private static final int __GENERATECERT_ISSET_ID = 3;
   private static final int __USEUSERCRPREF_ISSET_ID = 4;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = 
{_Fields.CREATION_TIME,_Fields.LAST_UPDATE_TIME,_Fields.PROCESS_STATUSES,_Fields.PROCESS_DETAIL,_Fields.APPLICATION_INTERFACE_ID,_Fields.APPLICATION_DEPLOYMENT_ID,_Fields.COMPUTE_RESOURCE_ID,_Fields.PROCESS_INPUTS,_Fields.PROCESS_OUTPUTS,_Fields.PROCESS_RESOURCE_SCHEDULE,_Fields.TASKS,_Fields.TASK_DAG,_Fields.PROCESS_ERRORS,_Fields.GATEWAY_EXECUTION_ID,_Fields.ENABLE_EMAIL_NOTIFICATION,_Fields.EMAIL_ADDRESSES,_Fields.STORAGE_RESOURCE_ID,_Fields.USER_DN,_Fields.GENERATE_CERT,_Fields.EXPERIMENT_DATA_DIR,_Fields.USER_NAME,_Fields.USE_USER_CRPREF};
+  private static final _Fields optionals[] = 
{_Fields.CREATION_TIME,_Fields.LAST_UPDATE_TIME,_Fields.PROCESS_STATUSES,_Fields.PROCESS_DETAIL,_Fields.APPLICATION_INTERFACE_ID,_Fields.APPLICATION_DEPLOYMENT_ID,_Fields.COMPUTE_RESOURCE_ID,_Fields.PROCESS_INPUTS,_Fields.PROCESS_OUTPUTS,_Fields.PROCESS_RESOURCE_SCHEDULE,_Fields.TASKS,_Fields.TASK_DAG,_Fields.PROCESS_ERRORS,_Fields.GATEWAY_EXECUTION_ID,_Fields.ENABLE_EMAIL_NOTIFICATION,_Fields.EMAIL_ADDRESSES,_Fields.STORAGE_RESOURCE_ID,_Fields.USER_DN,_Fields.GENERATE_CERT,_Fields.EXPERIMENT_DATA_DIR,_Fields.USER_NAME,_Fields.USE_USER_CRPREF,_Fields.GROUP_RESOURCE_PROFILE_ID};
   public static final java.util.Map<_Fields, 
org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = 
new java.util.EnumMap<_Fields, 
org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -282,6 +287,8 @@ public short getThriftFieldId() {
         new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.USE_USER_CRPREF, new 
org.apache.thrift.meta_data.FieldMetaData("useUserCRPref", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.GROUP_RESOURCE_PROFILE_ID, new 
org.apache.thrift.meta_data.FieldMetaData("groupResourceProfileId", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ProcessModel.class,
 metaDataMap);
   }
@@ -390,6 +397,9 @@ public ProcessModel(ProcessModel other) {
       this.userName = other.userName;
     }
     this.useUserCRPref = other.useUserCRPref;
+    if (other.isSetGroupResourceProfileId()) {
+      this.groupResourceProfileId = other.groupResourceProfileId;
+    }
   }
 
   public ProcessModel deepCopy() {
@@ -428,6 +438,7 @@ public void clear() {
     this.userName = null;
     setUseUserCRPrefIsSet(false);
     this.useUserCRPref = false;
+    this.groupResourceProfileId = null;
   }
 
   public java.lang.String getProcessId() {
@@ -1067,6 +1078,29 @@ public void setUseUserCRPrefIsSet(boolean value) {
     __isset_bitfield = 
org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, 
__USEUSERCRPREF_ISSET_ID, value);
   }
 
+  public java.lang.String getGroupResourceProfileId() {
+    return this.groupResourceProfileId;
+  }
+
+  public void setGroupResourceProfileId(java.lang.String 
groupResourceProfileId) {
+    this.groupResourceProfileId = groupResourceProfileId;
+  }
+
+  public void unsetGroupResourceProfileId() {
+    this.groupResourceProfileId = null;
+  }
+
+  /** Returns true if field groupResourceProfileId is set (has been assigned a 
value) and false otherwise */
+  public boolean isSetGroupResourceProfileId() {
+    return this.groupResourceProfileId != null;
+  }
+
+  public void setGroupResourceProfileIdIsSet(boolean value) {
+    if (!value) {
+      this.groupResourceProfileId = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, java.lang.Object value) {
     switch (field) {
     case PROCESS_ID:
@@ -1261,6 +1295,14 @@ public void setFieldValue(_Fields field, 
java.lang.Object value) {
       }
       break;
 
+    case GROUP_RESOURCE_PROFILE_ID:
+      if (value == null) {
+        unsetGroupResourceProfileId();
+      } else {
+        setGroupResourceProfileId((java.lang.String)value);
+      }
+      break;
+
     }
   }
 
@@ -1338,6 +1380,9 @@ public void setFieldValue(_Fields field, java.lang.Object 
value) {
     case USE_USER_CRPREF:
       return isUseUserCRPref();
 
+    case GROUP_RESOURCE_PROFILE_ID:
+      return getGroupResourceProfileId();
+
     }
     throw new java.lang.IllegalStateException();
   }
@@ -1397,6 +1442,8 @@ public boolean isSet(_Fields field) {
       return isSetUserName();
     case USE_USER_CRPREF:
       return isSetUseUserCRPref();
+    case GROUP_RESOURCE_PROFILE_ID:
+      return isSetGroupResourceProfileId();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -1632,6 +1679,15 @@ public boolean equals(ProcessModel that) {
         return false;
     }
 
+    boolean this_present_groupResourceProfileId = true && 
this.isSetGroupResourceProfileId();
+    boolean that_present_groupResourceProfileId = true && 
that.isSetGroupResourceProfileId();
+    if (this_present_groupResourceProfileId || 
that_present_groupResourceProfileId) {
+      if (!(this_present_groupResourceProfileId && 
that_present_groupResourceProfileId))
+        return false;
+      if (!this.groupResourceProfileId.equals(that.groupResourceProfileId))
+        return false;
+    }
+
     return true;
   }
 
@@ -1735,6 +1791,10 @@ public int hashCode() {
     if (isSetUseUserCRPref())
       hashCode = hashCode * 8191 + ((useUserCRPref) ? 131071 : 524287);
 
+    hashCode = hashCode * 8191 + ((isSetGroupResourceProfileId()) ? 131071 : 
524287);
+    if (isSetGroupResourceProfileId())
+      hashCode = hashCode * 8191 + groupResourceProfileId.hashCode();
+
     return hashCode;
   }
 
@@ -1986,6 +2046,16 @@ public int compareTo(ProcessModel other) {
         return lastComparison;
       }
     }
+    lastComparison = 
java.lang.Boolean.valueOf(isSetGroupResourceProfileId()).compareTo(other.isSetGroupResourceProfileId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGroupResourceProfileId()) {
+      lastComparison = 
org.apache.thrift.TBaseHelper.compareTo(this.groupResourceProfileId, 
other.groupResourceProfileId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -2221,6 +2291,16 @@ public void write(org.apache.thrift.protocol.TProtocol 
oprot) throws org.apache.
       sb.append(this.useUserCRPref);
       first = false;
     }
+    if (isSetGroupResourceProfileId()) {
+      if (!first) sb.append(", ");
+      sb.append("groupResourceProfileId:");
+      if (this.groupResourceProfileId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.groupResourceProfileId);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -2535,6 +2615,14 @@ public void read(org.apache.thrift.protocol.TProtocol 
iprot, ProcessModel struct
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
             }
             break;
+          case 25: // GROUP_RESOURCE_PROFILE_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.groupResourceProfileId = iprot.readString();
+              struct.setGroupResourceProfileIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
         }
@@ -2744,6 +2832,13 @@ public void write(org.apache.thrift.protocol.TProtocol 
oprot, ProcessModel struc
         oprot.writeBool(struct.useUserCRPref);
         oprot.writeFieldEnd();
       }
+      if (struct.groupResourceProfileId != null) {
+        if (struct.isSetGroupResourceProfileId()) {
+          oprot.writeFieldBegin(GROUP_RESOURCE_PROFILE_ID_FIELD_DESC);
+          oprot.writeString(struct.groupResourceProfileId);
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -2830,7 +2925,10 @@ public void write(org.apache.thrift.protocol.TProtocol 
prot, ProcessModel struct
       if (struct.isSetUseUserCRPref()) {
         optionals.set(21);
       }
-      oprot.writeBitSet(optionals, 22);
+      if (struct.isSetGroupResourceProfileId()) {
+        optionals.set(22);
+      }
+      oprot.writeBitSet(optionals, 23);
       if (struct.isSetCreationTime()) {
         oprot.writeI64(struct.creationTime);
       }
@@ -2933,6 +3031,9 @@ public void write(org.apache.thrift.protocol.TProtocol 
prot, ProcessModel struct
       if (struct.isSetUseUserCRPref()) {
         oprot.writeBool(struct.useUserCRPref);
       }
+      if (struct.isSetGroupResourceProfileId()) {
+        oprot.writeString(struct.groupResourceProfileId);
+      }
     }
 
     @Override
@@ -2942,7 +3043,7 @@ public void read(org.apache.thrift.protocol.TProtocol 
prot, ProcessModel struct)
       struct.setProcessIdIsSet(true);
       struct.experimentId = iprot.readString();
       struct.setExperimentIdIsSet(true);
-      java.util.BitSet incoming = iprot.readBitSet(22);
+      java.util.BitSet incoming = iprot.readBitSet(23);
       if (incoming.get(0)) {
         struct.creationTime = iprot.readI64();
         struct.setCreationTimeIsSet(true);
@@ -3091,6 +3192,10 @@ public void read(org.apache.thrift.protocol.TProtocol 
prot, ProcessModel struct)
         struct.useUserCRPref = iprot.readBool();
         struct.setUseUserCRPrefIsSet(true);
       }
+      if (incoming.get(22)) {
+        struct.groupResourceProfileId = iprot.readString();
+        struct.setGroupResourceProfileIdIsSet(true);
+      }
     }
   }
 
diff --git 
a/airavata-api/airavata-model-utils/src/main/java/org/apache/airavata/model/util/ExperimentModelUtil.java
 
b/airavata-api/airavata-model-utils/src/main/java/org/apache/airavata/model/util/ExperimentModelUtil.java
index 855dae4b09..0d1e7d636c 100644
--- 
a/airavata-api/airavata-model-utils/src/main/java/org/apache/airavata/model/util/ExperimentModelUtil.java
+++ 
b/airavata-api/airavata-model-utils/src/main/java/org/apache/airavata/model/util/ExperimentModelUtil.java
@@ -105,6 +105,7 @@ public static ProcessModel cloneProcessFromExperiment 
(ExperimentModel experimen
                 
processModel.setComputeResourceId(scheduling.getResourceHostId());
             }
             processModel.setUseUserCRPref(configData.isUseUserCRPref());
+            
processModel.setGroupResourceProfileId(configData.getGroupResourceProfileId());
         }
         processModel.setUserName(experiment.getUserName());
         return processModel;
diff --git 
a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
 
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
index c2f57c657d..296f0da234 100644
--- 
a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
+++ 
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
@@ -31,6 +31,8 @@
 import 
org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 import 
org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
+import 
org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference;
+import 
org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile;
 import 
org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
@@ -68,6 +70,8 @@
        private GatewayResourceProfile gatewayResourceProfile;
        private ComputeResourcePreference gatewayComputeResourcePreference;
        private StoragePreference gatewayStorageResourcePreference;
+       private GroupResourceProfile groupResourceProfile;
+       private GroupComputeResourcePreference groupComputeResourcePreference;
        private UserResourceProfile userResourceProfile;
        private UserComputeResourcePreference userComputeResourcePreference;
        private UserStoragePreference userStoragePreference;
@@ -168,7 +172,10 @@ public String getScratchLocation() {
                                scratchLocation = 
userComputeResourcePreference.getScratchLocation();
                        } else if 
(isValid(processModel.getProcessResourceSchedule().getOverrideScratchLocation()))
 {
                                scratchLocation = 
processModel.getProcessResourceSchedule().getOverrideScratchLocation();
-                       }else {
+                       } else if (isSetGroupResourceProfile() && 
groupComputeResourcePreference != null &&
+                                               
isValid(groupComputeResourcePreference.getScratchLocation())) {
+                               scratchLocation = 
groupComputeResourcePreference.getScratchLocation();
+                       } else {
                                scratchLocation = 
gatewayComputeResourcePreference.getScratchLocation();
                        }
                }
@@ -187,6 +194,22 @@ public void 
setGatewayResourceProfile(GatewayResourceProfile gatewayResourceProf
                this.gatewayResourceProfile = gatewayResourceProfile;
        }
 
+       public GroupResourceProfile getGroupResourceProfile() {
+               return groupResourceProfile;
+       }
+
+       public void setGroupResourceProfile(GroupResourceProfile 
groupResourceProfile) {
+               this.groupResourceProfile = groupResourceProfile;
+       }
+
+       public GroupComputeResourcePreference 
getGroupComputeResourcePreference() {
+               return groupComputeResourcePreference;
+       }
+
+       public void 
setGroupComputeResourcePreference(GroupComputeResourcePreference 
groupComputeResourcePreference) {
+               this.groupComputeResourcePreference = 
groupComputeResourcePreference;
+       }
+
        public UserResourceProfile getUserResourceProfile() {
                return userResourceProfile;
        }
@@ -308,7 +331,11 @@ public void setInputDir(String inputDir) {
 
        public JobSubmissionProtocol getJobSubmissionProtocol() {
                if (jobSubmissionProtocol == null) {
-                       jobSubmissionProtocol = 
gatewayComputeResourcePreference.getPreferredJobSubmissionProtocol();
+                       if (isSetGroupResourceProfile() && 
groupComputeResourcePreference != null) {
+                               jobSubmissionProtocol = 
groupComputeResourcePreference.getPreferredJobSubmissionProtocol();
+                       } else {
+                               jobSubmissionProtocol = 
gatewayComputeResourcePreference.getPreferredJobSubmissionProtocol();
+                       }
                }
                return jobSubmissionProtocol;
        }
@@ -319,7 +346,11 @@ public void setJobSubmissionProtocol(JobSubmissionProtocol 
jobSubmissionProtocol
 
        public DataMovementProtocol getDataMovementProtocol() {
                if (dataMovementProtocol == null) {
-                       dataMovementProtocol = 
gatewayComputeResourcePreference.getPreferredDataMovementProtocol();
+                       if (isSetGroupResourceProfile() && 
groupComputeResourcePreference != null) {
+                               dataMovementProtocol = 
groupComputeResourcePreference.getPreferredDataMovementProtocol();
+                       } else {
+                               dataMovementProtocol = 
gatewayComputeResourcePreference.getPreferredDataMovementProtocol();
+                       }
                }
                return dataMovementProtocol;
        }
@@ -417,6 +448,10 @@ public String getComputeResourceId() {
                                userComputeResourcePreference != null &&
                                
isValid(userComputeResourcePreference.getComputeResourceId())) {
                        return 
userComputeResourcePreference.getComputeResourceId();
+               } else if (isSetGroupResourceProfile() &&
+                                       groupComputeResourcePreference != null 
&&
+                                       
isValid(groupComputeResourcePreference.getComputeResourceId())){
+                       return 
groupComputeResourcePreference.getComputeResourceId();
                } else {
                        return 
gatewayComputeResourcePreference.getComputeResourceId();
                }
@@ -430,7 +465,11 @@ public String getComputeResourceCredentialToken(){
                        } else {
                                return 
userResourceProfile.getCredentialStoreToken();
                        }
-               } else {
+               } else if (isSetGroupResourceProfile() &&
+                    groupComputeResourcePreference != null &&
+                    
isValid(groupComputeResourcePreference.getResourceSpecificCredentialStoreToken()))
 {
+                return 
groupComputeResourcePreference.getResourceSpecificCredentialStoreToken();
+        } else {
                        if 
(isValid(gatewayComputeResourcePreference.getResourceSpecificCredentialStoreToken()))
 {
                                return 
gatewayComputeResourcePreference.getResourceSpecificCredentialStoreToken();
                        } else {
@@ -448,11 +487,21 @@ public String getStorageResourceCredentialToken(){
        }
 
        public JobSubmissionProtocol getPreferredJobSubmissionProtocol(){
-               return 
gatewayComputeResourcePreference.getPreferredJobSubmissionProtocol();
+           if (isSetGroupResourceProfile() &&
+                groupComputeResourcePreference != null &&
+                
groupComputeResourcePreference.getPreferredJobSubmissionProtocol() != null) {
+               return 
groupComputeResourcePreference.getPreferredJobSubmissionProtocol();
+        }
+        return 
gatewayComputeResourcePreference.getPreferredJobSubmissionProtocol();
        }
 
        public DataMovementProtocol getPreferredDataMovementProtocol() {
-               return 
gatewayComputeResourcePreference.getPreferredDataMovementProtocol();
+           if (isSetGroupResourceProfile() &&
+                groupComputeResourcePreference != null &&
+                
groupComputeResourcePreference.getPreferredDataMovementProtocol() != null) {
+               return 
groupComputeResourcePreference.getPreferredDataMovementProtocol();
+        }
+        return 
gatewayComputeResourcePreference.getPreferredDataMovementProtocol();
        }
 
        public void setMonitorMode(MonitorMode monitorMode) {
@@ -570,6 +619,10 @@ public boolean isUseUserCRPref() {
                return getProcessModel().isUseUserCRPref();
        }
 
+       public boolean isSetGroupResourceProfile() {
+               return getProcessModel().isSetGroupResourceProfileId();
+       }
+
        public String getComputeResourceLoginUserName(){
                if (isUseUserCRPref() &&
                                userComputeResourcePreference != null &&
@@ -577,7 +630,12 @@ public String getComputeResourceLoginUserName(){
                        return userComputeResourcePreference.getLoginUserName();
                } else if 
(isValid(processModel.getProcessResourceSchedule().getOverrideLoginUserName())) 
{
                        return 
processModel.getProcessResourceSchedule().getOverrideLoginUserName();
-               } else {
+               } else if (isSetGroupResourceProfile() &&
+                                               groupComputeResourcePreference 
!= null &&
+                                               
isValid(groupComputeResourcePreference.getLoginUserName())){
+                       return 
groupComputeResourcePreference.getLoginUserName();
+               }
+               else {
                        return 
gatewayComputeResourcePreference.getLoginUserName();
                }
        }
@@ -651,6 +709,11 @@ private boolean isValid(String str) {
        }
 
        public String getUsageReportingGatewayId() {
+           if (isSetGroupResourceProfile() &&
+                groupComputeResourcePreference != null &&
+                
isValid(groupComputeResourcePreference.getUsageReportingGatewayId())) {
+               return 
groupComputeResourcePreference.getUsageReportingGatewayId();
+        }
                return 
gatewayComputeResourcePreference.getUsageReportingGatewayId();
        }
 
@@ -659,6 +722,10 @@ public String getAllocationProjectNumber() {
                                userComputeResourcePreference != null &&
                                
userComputeResourcePreference.getAllocationProjectNumber() != null) {
                        return 
userComputeResourcePreference.getAllocationProjectNumber();
+               } else if (isSetGroupResourceProfile() &&
+                                       groupComputeResourcePreference != null 
&&
+                                       
isValid(groupComputeResourcePreference.getAllocationProjectNumber())){
+                       return 
groupComputeResourcePreference.getAllocationProjectNumber();
                } else {
                        return 
gatewayComputeResourcePreference.getAllocationProjectNumber();
                }
@@ -673,6 +740,12 @@ public String getReservation() {
                        reservation = 
userComputeResourcePreference.getReservation();
                        start = 
userComputeResourcePreference.getReservationStartTime();
                        end = 
userComputeResourcePreference.getReservationEndTime();
+               } else if (isSetGroupResourceProfile() &&
+                                               groupComputeResourcePreference 
!= null &&
+                                               
isValid(groupComputeResourcePreference.getReservation())){
+                       reservation = 
groupComputeResourcePreference.getReservation();
+                       start = 
groupComputeResourcePreference.getReservationStartTime();
+                       end = 
groupComputeResourcePreference.getReservationEndTime();
                } else {
                        reservation = 
gatewayComputeResourcePreference.getReservation();
                        start = 
gatewayComputeResourcePreference.getReservationStartTime();
@@ -692,7 +765,11 @@ public String getQualityOfService() {
                                userComputeResourcePreference != null &&
                                
userComputeResourcePreference.getQualityOfService() != null) {
                        return 
userComputeResourcePreference.getQualityOfService();
-               } else {
+               } else if (isSetGroupResourceProfile() &&
+                        groupComputeResourcePreference != null &&
+                        
isValid(groupComputeResourcePreference.getQualityOfService())){
+                   return groupComputeResourcePreference.getQualityOfService();
+        } else {
                        return 
gatewayComputeResourcePreference.getQualityOfService();
                }
        }
@@ -705,7 +782,11 @@ public String getQueueName() {
                                userComputeResourcePreference != null &&
                                
userComputeResourcePreference.getPreferredBatchQueue() != null) {
                        return 
userComputeResourcePreference.getPreferredBatchQueue();
-               } else {
+               } else if (isSetGroupResourceProfile() &&
+                    groupComputeResourcePreference != null &&
+                    
isValid(groupComputeResourcePreference.getPreferredBatchQueue())){
+                   return 
groupComputeResourcePreference.getPreferredBatchQueue();
+        } else {
                        return 
gatewayComputeResourcePreference.getPreferredBatchQueue();
                }
        }
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 249a91abec..496706a597 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
@@ -46,6 +46,8 @@
 import org.apache.airavata.model.appcatalog.computeresource.MonitorMode;
 import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager;
 import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission;
+import 
org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference;
+import 
org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile;
 import 
org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
@@ -124,6 +126,11 @@ public ProcessContext populateProcessContext(String 
processId, String gatewayId,
                 setUserComputeResourcePreference(gatewayId, processContext, 
registryClient);
             }
 
+            if (processModel.isSetGroupResourceProfileId()) {
+                
setGroupResourceProfile(processModel.getGroupResourceProfileId(), 
processContext, registryClient);
+                
setGroupComputeResourcePreference(processModel.getGroupResourceProfileId(), 
processContext, registryClient);
+            }
+
             String scratchLocation = processContext.getScratchLocation();
             String workingDirectory = scratchLocation + File.separator + 
processId + File.separator;
             StorageResourceDescription storageResource = 
registryClient.getStorageResource(processModel.getStorageResourceId());
@@ -231,6 +238,19 @@ private void setUserComputeResourcePreference(String 
gatewayId, ProcessContext p
         
processContext.setUserComputeResourcePreference(userComputeResourcePreference);
     }
 
+    private void setGroupResourceProfile(String groupResourceProfileId, 
ProcessContext processContext, RegistryService.Client registryClient) throws 
TException {
+        GroupResourceProfile groupResourceProfile = 
registryClient.getGroupResourceProfile(groupResourceProfileId);
+        processContext.setGroupResourceProfile(groupResourceProfile);
+    }
+
+    private void setGroupComputeResourcePreference(String 
groupResourceProfileId, ProcessContext processContext, RegistryService.Client 
registryClient) throws TException {
+        ProcessModel processModel = processContext.getProcessModel();
+        GroupComputeResourcePreference groupComputeResourcePreference 
=registryClient.getGroupComputeResourcePreference(
+                                                                            
processModel.getComputeResourceId(),
+                                                                            
groupResourceProfileId);
+        
processContext.setGroupComputeResourcePreference(groupComputeResourcePreference);
+    }
+
     private void checkRecoveryWithCancel(ProcessContext processContext) throws 
Exception {
         CuratorFramework curatorClient = processContext.getCuratorClient();
         String experimentId = processContext.getExperimentId();
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Process.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Process.java
index 97076868ab..c6f2697437 100644
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Process.java
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Process.java
@@ -55,6 +55,7 @@
     private String userDn;
     private boolean generateCert;
     private boolean useUserCRPref;
+    private String groupResourceProfileId;
 
     @Id
     @Column(name = "PROCESS_ID")
@@ -320,4 +321,13 @@ public boolean isUseUserCRPref() {
     public void setUseUserCRPref(boolean useUserCRPref) {
         this.useUserCRPref = useUserCRPref;
     }
+
+    @Column(name = "GROUP_RESOURCE_PROFILE_ID")
+    public String getGroupResourceProfileId() {
+        return groupResourceProfileId;
+    }
+
+    public void setGroupResourceProfileId(String groupResourceProfileId) {
+        this.groupResourceProfileId = groupResourceProfileId;
+    }
 }
\ No newline at end of file
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
index 3ba5111739..7bf1d30f05 100644
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
@@ -56,6 +56,7 @@
     private boolean generateCert;
     private String experimentDataDir;
     private boolean useUserCRPref;
+    private String groupResourceProfileId;
 
     public String getProcessId() {
         return processId;
@@ -201,6 +202,14 @@ public void setUseUserCRPref(boolean useUserCRPref) {
         this.useUserCRPref = useUserCRPref;
     }
 
+    public String getGroupResourceProfileId() {
+        return groupResourceProfileId;
+    }
+
+    public void setGroupResourceProfileId(String groupResourceProfileId) {
+        this.groupResourceProfileId = groupResourceProfileId;
+    }
+
     public ExperimentCatResource create(ResourceType type) throws 
RegistryException{
        switch (type){
            case PROCESS_ERROR:
@@ -608,6 +617,7 @@ public void save() throws RegistryException{
             process.setExperimentDataDir(experimentDataDir);
             process.setUserName(userName);
             process.setUseUserCRPref(useUserCRPref);
+            process.setGroupResourceProfileId(groupResourceProfileId);
 
             if (existingProcess == null){
                 em.persist(process);
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
index ce26eb78fd..ebee1fa133 100644
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
@@ -584,6 +584,7 @@ private static ExperimentCatResource createProcess (Process 
o){
             processResource.setExperimentDataDir(o.getExperimentDataDir());
             processResource.setUserName(o.getUserName());
             processResource.setUseUserCRPref(o.isUseUserCRPref());
+            
processResource.setGroupResourceProfileId(o.getGroupResourceProfileId());
         }
         return processResource;
     }
diff --git 
a/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql 
b/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
index 18b54a9310..2b52834d27 100644
--- a/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
@@ -232,6 +232,7 @@ CREATE TABLE PROCESS (
   GENERATE_CERT SMALLINT,
   EXPERIMENT_DATA_DIR VARCHAR (512),
   USERNAME VARCHAR (255),
+  GROUP_RESOURCE_PROFILE_ID VARCHAR (255) DEFAULT NULL,
   PRIMARY KEY (PROCESS_ID),
   FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE 
CASCADE
 );
diff --git 
a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql 
b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
index 39bd62c3aa..80643dc906 100644
--- a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
@@ -236,6 +236,7 @@ CREATE TABLE PROCESS (
   GENERATE_CERT SMALLINT,
   EXPERIMENT_DATA_DIR VARCHAR (512),
   USERNAME VARCHAR (255),
+  GROUP_RESOURCE_PROFILE_ID VARCHAR (255) DEFAULT NULL,
   PRIMARY KEY (PROCESS_ID),
   FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE 
CASCADE
 );
diff --git 
a/thrift-interface-descriptions/data-models/experiment-catalog-models/process_model.thrift
 
b/thrift-interface-descriptions/data-models/experiment-catalog-models/process_model.thrift
index 3b937d54c6..ff91883664 100644
--- 
a/thrift-interface-descriptions/data-models/experiment-catalog-models/process_model.thrift
+++ 
b/thrift-interface-descriptions/data-models/experiment-catalog-models/process_model.thrift
@@ -63,5 +63,6 @@ struct ProcessModel {
     21: optional bool generateCert = 0,
     22: optional string experimentDataDir,
     23: optional string userName,
-    24: optional bool useUserCRPref;
+    24: optional bool useUserCRPref,
+    25: optional string groupResourceProfileId;
 }
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Add GroupResourceProfile to ProcessModel
> ----------------------------------------
>
>                 Key: AIRAVATA-2696
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2696
>             Project: Airavata
>          Issue Type: Bug
>            Reporter: Marcus Christie
>            Assignee: Sachin Kariyattin
>            Priority: Major
>
> TODO
> * add groupResourceProfileId to ProcessModel
> * update ExperimentModelUtil to copy groupResourceProfileId to ProcessModel
> * Load GroupResourceProfile in GFacEngineImpl.populateProcessContext
> * Use GroupResourceProfile in ProcessContext do the credential token lookup 
> in getComputeResourceCredentialToken()
> * Load GroupComputeResourcePreference in GFacEngineImpl.populateProcessContext
> * Use GroupComputeResourcePreference for the following:
> ** getAllocationProjectNumber() - instead of gatewayComputeResourcePreference
> ** getComputeResourceCredentialToken() - with fallback to 
> gatewayComputeResourcePreference
> ** getComputeResourceId() - instead of gatewayComputeResourcePreference
> ** getComputeResourceLoginUserName() - fallback to 
> gatewayComputeResourcePreference
> ** getDataMovementProtocol() - instead of gatewayComputeResourcePreference
> ** getJobSubmissionProtocol() - instead of gatewayComputeResourcePreference
> ** getPreferredDataMovementProtocol() - instead of 
> gatewayComputeResourcePreference
> ** getPreferredJobSubmissionProtocol() - instead of 
> gatewayComputeResourcePreference
> ** getQualityOfService() - instead of gatewayComputeResourcePreference
> ** getQueueName() - instead of gatewayComputeResourcePreference
> ** getReservation() - instead of gatewayComputeResourcePreference
> ** getScratchLocation() - instead of getScratchLocation
> ** getUsageReportingGatewayId() - with fallback to 
> gatewayComputeResourcePreference



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to