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 User CR Pref over Gateway CR Pref
Date Tue, 08 Nov 2016 20:26:43 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop b8977a7ec -> 3660cd8ff


Give precedence to User CR Pref over Gateway CR Pref


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

Branch: refs/heads/develop
Commit: 3660cd8ff9f025b84ff9404792c4aca7f2b0a136
Parents: b8977a7
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Tue Nov 8 15:26:30 2016 -0500
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Tue Nov 8 15:26:30 2016 -0500

----------------------------------------------------------------------
 .../resources/lib/Airavata/API/Airavata.php     |  82 +++++------
 .../model/util/ExperimentModelUtil.java         |   1 +
 .../apache/airavata/gfac/core/GFacUtils.java    |  44 +-----
 .../gfac/core/context/ProcessContext.java       | 135 +++++++++++++++++--
 .../org/apache/airavata/gfac/impl/Factory.java  |  46 +------
 .../airavata/gfac/impl/GFacEngineImpl.java      |  58 ++++++--
 .../impl/task/DefaultJobSubmissionTask.java     |   2 +-
 .../gfac/impl/task/utils/bes/JSDLGenerator.java |   5 +-
 .../catalog/impl/ExperimentRegistry.java        |   6 +-
 .../core/experiment/catalog/model/Process.java  |  10 ++
 .../catalog/resources/ProcessResource.java      |  11 ++
 .../experiment/catalog/resources/Utils.java     |   1 +
 .../utils/ThriftDataModelConversion.java        |   3 +-
 13 files changed, 257 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
index 0cea7e2..d75e594 100644
--- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
@@ -3027,7 +3027,7 @@ interface AiravataIf {
    * @param computeResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @param computeResourcePreference
+   * @param gatewayComputeResourcePreference
    *   The ComputeResourcePreference object to be added to the resource profile.
    * 
    * @return status
@@ -3038,14 +3038,14 @@ interface AiravataIf {
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $gatewayID
    * @param string $computeResourceId
-   * @param \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference
+   * @param \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference
    * @return bool
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function addGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference);
+  public function addGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference);
   /**
    * Add a Storage Resource Preference to a registered gateway profile.
    * 
@@ -3055,7 +3055,7 @@ interface AiravataIf {
    * @param storageResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @param computeResourcePreference
+   * @param gatewayComputeResourcePreference
    *   The ComputeResourcePreference object to be added to the resource profile.
    * 
    * @return status
@@ -3084,7 +3084,7 @@ interface AiravataIf {
    * @param computeResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @return computeResourcePreference
+   * @return gatewayComputeResourcePreference
    *   Returns the ComputeResourcePreference object.
    * 
    * 
@@ -3161,7 +3161,7 @@ interface AiravataIf {
    * @param gatewayID
    *   The identifier for the gateway profile to be requested
    * 
-   * @return computeResourcePreference
+   * @return gatewayComputeResourcePreference
    *   Returns the ComputeResourcePreference object.
    * 
    * 
@@ -3219,7 +3219,7 @@ interface AiravataIf {
    * @param computeResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @param computeResourcePreference
+   * @param gatewayComputeResourcePreference
    *   The ComputeResourcePreference object to be updated to the resource profile.
    * 
    * @return status
@@ -3229,14 +3229,14 @@ interface AiravataIf {
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $gatewayID
    * @param string $computeResourceId
-   * @param \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference
+   * @param \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference
    * @return bool
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function updateGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference);
+  public function updateGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference);
   /**
    * Update a Storage Resource Preference of a registered gateway profile.
    * 
@@ -3437,7 +3437,7 @@ interface AiravataIf {
    * @param computeResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @param computeResourcePreference
+   * @param gatewayComputeResourcePreference
    *   The ComputeResourcePreference object to be added to the resource profile.
    * 
    * @return status
@@ -3469,7 +3469,7 @@ interface AiravataIf {
    * @param storageResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @param computeResourcePreference
+   * @param gatewayComputeResourcePreference
    *   The ComputeResourcePreference object to be added to the resource profile.
    * 
    * @return status
@@ -3502,7 +3502,7 @@ interface AiravataIf {
    * @param userComputeResourceId
    *   Preferences related to a particular compute resource
    * 
-   * @return computeResourcePreference
+   * @return gatewayComputeResourcePreference
    *   Returns the ComputeResourcePreference object.
    * 
    * 
@@ -3580,7 +3580,7 @@ interface AiravataIf {
    * @param gatewayID
    *   The identifier for the gateway profile to be requested
    * 
-   * @return computeResourcePreference
+   * @return gatewayComputeResourcePreference
    *   Returns the ComputeResourcePreference object.
    * 
    * 
@@ -11807,19 +11807,19 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("deleteGatewayResourceProfile failed: unknown result");
   }
 
-  public function addGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference)
+  public function addGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference)
   {
-    $this->send_addGatewayComputeResourcePreference($authzToken, $gatewayID, $computeResourceId, $computeResourcePreference);
+    $this->send_addGatewayComputeResourcePreference($authzToken, $gatewayID, $computeResourceId, $gatewayComputeResourcePreference);
     return $this->recv_addGatewayComputeResourcePreference();
   }
 
-  public function send_addGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference)
+  public function send_addGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference)
   {
     $args = new \Airavata\API\Airavata_addGatewayComputeResourcePreference_args();
     $args->authzToken = $authzToken;
     $args->gatewayID = $gatewayID;
     $args->computeResourceId = $computeResourceId;
-    $args->computeResourcePreference = $computeResourcePreference;
+    $args->gatewayComputeResourcePreference = $gatewayComputeResourcePreference;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -12260,19 +12260,19 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getAllGatewayResourceProfiles failed: unknown result");
   }
 
-  public function updateGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference)
+  public function updateGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference)
   {
-    $this->send_updateGatewayComputeResourcePreference($authzToken, $gatewayID, $computeResourceId, $computeResourcePreference);
+    $this->send_updateGatewayComputeResourcePreference($authzToken, $gatewayID, $computeResourceId, $gatewayComputeResourcePreference);
     return $this->recv_updateGatewayComputeResourcePreference();
   }
 
-  public function send_updateGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $computeResourcePreference)
+  public function send_updateGatewayComputeResourcePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $computeResourceId, \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference $gatewayComputeResourcePreference)
   {
     $args = new \Airavata\API\Airavata_updateGatewayComputeResourcePreference_args();
     $args->authzToken = $authzToken;
     $args->gatewayID = $gatewayID;
     $args->computeResourceId = $computeResourceId;
-    $args->computeResourcePreference = $computeResourcePreference;
+    $args->gatewayComputeResourcePreference = $gatewayComputeResourcePreference;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -51622,7 +51622,7 @@ class Airavata_addGatewayComputeResourcePreference_args {
   /**
    * @var \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference
    */
-  public $computeResourcePreference = null;
+  public $gatewayComputeResourcePreference = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -51641,7 +51641,7 @@ class Airavata_addGatewayComputeResourcePreference_args {
           'type' => TType::STRING,
           ),
         4 => array(
-          'var' => 'computeResourcePreference',
+          'var' => 'gatewayComputeResourcePreference',
           'type' => TType::STRUCT,
           'class' => '\Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference',
           ),
@@ -51657,8 +51657,8 @@ class Airavata_addGatewayComputeResourcePreference_args {
       if (isset($vals['computeResourceId'])) {
         $this->computeResourceId = $vals['computeResourceId'];
       }
-      if (isset($vals['computeResourcePreference'])) {
-        $this->computeResourcePreference = $vals['computeResourcePreference'];
+      if (isset($vals['gatewayComputeResourcePreference'])) {
+        $this->gatewayComputeResourcePreference = $vals['gatewayComputeResourcePreference'];
       }
     }
   }
@@ -51706,8 +51706,8 @@ class Airavata_addGatewayComputeResourcePreference_args {
           break;
         case 4:
           if ($ftype == TType::STRUCT) {
-            $this->computeResourcePreference = new \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference();
-            $xfer += $this->computeResourcePreference->read($input);
+            $this->gatewayComputeResourcePreference = new \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference();
+            $xfer += $this->gatewayComputeResourcePreference->read($input);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -51743,12 +51743,12 @@ class Airavata_addGatewayComputeResourcePreference_args {
       $xfer += $output->writeString($this->computeResourceId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->computeResourcePreference !== null) {
-      if (!is_object($this->computeResourcePreference)) {
+    if ($this->gatewayComputeResourcePreference !== null) {
+      if (!is_object($this->gatewayComputeResourcePreference)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('computeResourcePreference', TType::STRUCT, 4);
-      $xfer += $this->computeResourcePreference->write($output);
+      $xfer += $output->writeFieldBegin('gatewayComputeResourcePreference', TType::STRUCT, 4);
+      $xfer += $this->gatewayComputeResourcePreference->write($output);
       $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
@@ -53787,7 +53787,7 @@ class Airavata_updateGatewayComputeResourcePreference_args {
   /**
    * @var \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference
    */
-  public $computeResourcePreference = null;
+  public $gatewayComputeResourcePreference = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -53806,7 +53806,7 @@ class Airavata_updateGatewayComputeResourcePreference_args {
           'type' => TType::STRING,
           ),
         4 => array(
-          'var' => 'computeResourcePreference',
+          'var' => 'gatewayComputeResourcePreference',
           'type' => TType::STRUCT,
           'class' => '\Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference',
           ),
@@ -53822,8 +53822,8 @@ class Airavata_updateGatewayComputeResourcePreference_args {
       if (isset($vals['computeResourceId'])) {
         $this->computeResourceId = $vals['computeResourceId'];
       }
-      if (isset($vals['computeResourcePreference'])) {
-        $this->computeResourcePreference = $vals['computeResourcePreference'];
+      if (isset($vals['gatewayComputeResourcePreference'])) {
+        $this->gatewayComputeResourcePreference = $vals['gatewayComputeResourcePreference'];
       }
     }
   }
@@ -53871,8 +53871,8 @@ class Airavata_updateGatewayComputeResourcePreference_args {
           break;
         case 4:
           if ($ftype == TType::STRUCT) {
-            $this->computeResourcePreference = new \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference();
-            $xfer += $this->computeResourcePreference->read($input);
+            $this->gatewayComputeResourcePreference = new \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference();
+            $xfer += $this->gatewayComputeResourcePreference->read($input);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -53908,12 +53908,12 @@ class Airavata_updateGatewayComputeResourcePreference_args {
       $xfer += $output->writeString($this->computeResourceId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->computeResourcePreference !== null) {
-      if (!is_object($this->computeResourcePreference)) {
+    if ($this->gatewayComputeResourcePreference !== null) {
+      if (!is_object($this->gatewayComputeResourcePreference)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('computeResourcePreference', TType::STRUCT, 4);
-      $xfer += $this->computeResourcePreference->write($output);
+      $xfer += $output->writeFieldBegin('gatewayComputeResourcePreference', TType::STRUCT, 4);
+      $xfer += $this->gatewayComputeResourcePreference->write($output);
       $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/airavata-api/airavata-model-utils/src/main/java/org/apache/airavata/model/util/ExperimentModelUtil.java
----------------------------------------------------------------------
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 07f38e4..0647a8d 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
@@ -106,6 +106,7 @@ public class ExperimentModelUtil {
                 processModel.setProcessResourceSchedule(scheduling);
                 processModel.setComputeResourceId(scheduling.getResourceHostId());
             }
+            processModel.setUseUserCRPref(configData.isUseUserCRPref());
         }
         processModel.setUserName(experiment.getUserName());
         return processModel;

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/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 66998c3..bef7bfb 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
@@ -502,11 +502,8 @@ public class GFacUtils {
         groovyMap.add(Script.GATEWAY_USER_NAME, processContext.getProcessModel().getUserName());
         groovyMap.add(Script.APPLICATION_NAME, processContext.getApplicationInterfaceDescription().getApplicationName());
 
-        ComputeResourcePreference crp = getComputeResourcePreference(processContext);
-        if (isValid(crp.getAllocationProjectNumber())) {
-            groovyMap.add(Script.ACCOUNT_STRING, crp.getAllocationProjectNumber());
-        }
-        groovyMap.add(Script.RESERVATION, getReservation(crp));
+        groovyMap.add(Script.ACCOUNT_STRING, processContext.getAllocationProjectNumber());
+        groovyMap.add(Script.RESERVATION, processContext.getReservation());
 
         // To make job name alpha numeric
         groovyMap.add(Script.JOB_NAME, "A" + String.valueOf(generateJobName()));
@@ -544,7 +541,7 @@ public class GFacUtils {
                 groovyMap.add(Script.NODES, totalNodeCount);
             }
             // qos per queue
-            String qoS = getQoS(crp.getQualityOfService(), scheduling.getQueueName());
+            String qoS = getQoS(processContext.getQualityOfService(), processContext.getQueueName());
             if (qoS != null) {
                 groovyMap.add(Script.QUALITY_OF_SERVICE, qoS);
             }
@@ -664,21 +661,6 @@ public class GFacUtils {
         }
     }
 
-    private static String getReservation(ComputeResourcePreference crp) {
-        long start = crp.getReservationStartTime();
-        long end = crp.getReservationEndTime();
-        String reservation = null;
-        if (start > 0 && start < end) {
-            long now = Calendar.getInstance().getTimeInMillis();
-            if (now > start && now < end) {
-                reservation = crp.getReservation();
-            }
-        } else {
-            reservation = crp.getReservation();
-        }
-       return reservation;
-    }
-
     private static List<String> getProcessOutputValues(List<OutputDataObjectType> processOutputs) {
         List<String> inputValues = new ArrayList<>();
         if (processOutputs != null) {
@@ -825,12 +807,11 @@ public class GFacUtils {
         }
     }
 
-    public static JobSubmissionInterface getPreferredJobSubmissionInterface(ProcessContext context) throws AppCatalogException {
+    public static JobSubmissionInterface getPreferredJobSubmissionInterface(ProcessContext processContext) throws AppCatalogException {
         try {
-            String resourceHostId = context.getComputeResourceDescription().getComputeResourceId();
-            ComputeResourcePreference resourcePreference = context.getComputeResourcePreference();
-            JobSubmissionProtocol preferredJobSubmissionProtocol = resourcePreference.getPreferredJobSubmissionProtocol();
-            ComputeResourceDescription resourceDescription = context.getAppCatalog().getComputeResource().getComputeResource(resourceHostId);
+            String resourceHostId = processContext.getComputeResourceDescription().getComputeResourceId();
+            JobSubmissionProtocol preferredJobSubmissionProtocol = processContext.getPreferredJobSubmissionProtocol();
+            ComputeResourceDescription resourceDescription = processContext.getAppCatalog().getComputeResource().getComputeResource(resourceHostId);
             List<JobSubmissionInterface> jobSubmissionInterfaces = resourceDescription.getJobSubmissionInterfaces();
             Map<JobSubmissionProtocol, List<JobSubmissionInterface>> orderedInterfaces = new HashMap<>();
             List<JobSubmissionInterface> interfaces = new ArrayList<>();
@@ -885,17 +866,6 @@ public class GFacUtils {
         }
     }
 
-    public static ComputeResourcePreference getComputeResourcePreference(ProcessContext context) throws AppCatalogException {
-        try {
-            GwyResourceProfile gatewayProfile = context.getAppCatalog().getGatewayProfile();
-            String resourceHostId = context.getComputeResourceDescription().getComputeResourceId();
-            return gatewayProfile.getComputeResourcePreference(context.getGatewayId(), resourceHostId);
-        } catch (AppCatalogException e) {
-            log.error("Error occurred while initializing app catalog", e);
-            throw new AppCatalogException("Error occurred while initializing app catalog", e);
-        }
-    }
-
     public static File createJobFile(GroovyMap groovyMap, TaskContext tc, JobManagerConfiguration jMC)
             throws GFacException{
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
----------------------------------------------------------------------
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 8079e2a..1b2fb22 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
@@ -34,6 +34,8 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePrefer
 import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
 import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
 import org.apache.airavata.model.data.movement.DataMovementProtocol;
 import org.apache.airavata.model.job.JobModel;
 import org.apache.airavata.model.process.ProcessModel;
@@ -47,6 +49,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -69,6 +72,9 @@ public class ProcessContext {
 	private String outputDir;
 	private String localWorkingDir;
 	private GatewayResourceProfile gatewayResourceProfile;
+	private ComputeResourcePreference gatewayComputeResourcePreference;
+	private UserResourceProfile userResourceProfile;
+	private UserComputeResourcePreference userComputeResourcePreference;
 	private ComputeResourceDescription computeResourceDescription;
 	private ApplicationDeploymentDescription applicationDeploymentDescription;
 	private ApplicationInterfaceDescription applicationInterfaceDescription;
@@ -80,7 +86,6 @@ public class ProcessContext {
 	private JobSubmissionProtocol jobSubmissionProtocol;
 	private DataMovementProtocol dataMovementProtocol;
 	private JobModel jobModel;
-	private ComputeResourcePreference computeResourcePreference;
     private StoragePreference storagePreference;
     private StorageResourceDescription storageResource;
 	private MonitorMode monitorMode;
@@ -98,6 +103,7 @@ public class ProcessContext {
 	private boolean acknowledge;
 	private SSHKeyAuthentication sshKeyAuthentication;
 	private boolean recoveryWithCancel = false;
+	private String usageReportingGatewayId;
 
 	/**
 	 * Note: process context property use lazy loading approach. In runtime you will see some properties as null
@@ -177,9 +183,12 @@ public class ProcessContext {
 
 	public String getScratchLocation() {
 		if (scratchLocation == null) {
-			scratchLocation = processModel.getProcessResourceSchedule().getOverrideScratchLocation();
-			if(scratchLocation == null || scratchLocation.isEmpty()){
-				scratchLocation = computeResourcePreference.getScratchLocation();
+			if (processModel.isUseUserCRPref() && isValid(userComputeResourcePreference.getScratchLocation())) {
+				scratchLocation = userComputeResourcePreference.getScratchLocation();
+			} else if (isValid(processModel.getProcessResourceSchedule().getOverrideScratchLocation())) {
+				scratchLocation = processModel.getProcessResourceSchedule().getOverrideScratchLocation();
+			}else {
+				scratchLocation = gatewayComputeResourcePreference.getScratchLocation();
 			}
 		}
 		return scratchLocation;
@@ -197,6 +206,22 @@ public class ProcessContext {
 		this.gatewayResourceProfile = gatewayResourceProfile;
 	}
 
+	public UserResourceProfile getUserResourceProfile() {
+		return userResourceProfile;
+	}
+
+	public void setUserResourceProfile(UserResourceProfile userResourceProfile) {
+		this.userResourceProfile = userResourceProfile;
+	}
+
+	private UserComputeResourcePreference getUserComputeResourcePreference() {
+		return userComputeResourcePreference;
+	}
+
+	public void setUserComputeResourcePreference(UserComputeResourcePreference userComputeResourcePreference) {
+		this.userComputeResourcePreference = userComputeResourcePreference;
+	}
+
 	public RemoteCluster getJobSubmissionRemoteCluster() {
 		return jobSubmissionRemoteCluster;
 	}
@@ -286,7 +311,7 @@ public class ProcessContext {
 
 	public JobSubmissionProtocol getJobSubmissionProtocol() {
 		if (jobSubmissionProtocol == null) {
-			jobSubmissionProtocol = computeResourcePreference.getPreferredJobSubmissionProtocol();
+			jobSubmissionProtocol = gatewayComputeResourcePreference.getPreferredJobSubmissionProtocol();
 		}
 		return jobSubmissionProtocol;
 	}
@@ -297,7 +322,7 @@ public class ProcessContext {
 
 	public DataMovementProtocol getDataMovementProtocol() {
 		if (dataMovementProtocol == null) {
-			dataMovementProtocol = computeResourcePreference.getPreferredDataMovementProtocol();
+			dataMovementProtocol = gatewayComputeResourcePreference.getPreferredDataMovementProtocol();
 		}
 		return dataMovementProtocol;
 	}
@@ -358,12 +383,12 @@ public class ProcessContext {
 		this.jobModel = jobModel;
 	}
 
-	public ComputeResourcePreference getComputeResourcePreference() {
-		return computeResourcePreference;
+	private ComputeResourcePreference getGatewayComputeResourcePreference() {
+		return gatewayComputeResourcePreference;
 	}
 
-	public void setComputeResourcePreference(ComputeResourcePreference computeResourcePreference) {
-		this.computeResourcePreference = computeResourcePreference;
+	public void setGatewayComputeResourcePreference(ComputeResourcePreference gatewayComputeResourcePreference) {
+		this.gatewayComputeResourcePreference = gatewayComputeResourcePreference;
 	}
 
 	public ProcessState getProcessState() {
@@ -391,7 +416,29 @@ public class ProcessContext {
 	}
 
 	public String getComputeResourceId() {
-		return getComputeResourceDescription().getComputeResourceId();
+		if (isUseUserCRPref()) {
+			return userComputeResourcePreference.getComputeResourceId();
+		} else {
+			return gatewayComputeResourcePreference.getComputeResourceId();
+		}
+	}
+
+	public String getCredentialToken(){
+		if (isUseUserCRPref() && isValid(userComputeResourcePreference.getResourceSpecificCredentialStoreToken())) {
+			return userComputeResourcePreference.getResourceSpecificCredentialStoreToken();
+		} else if (isValid(gatewayComputeResourcePreference.getResourceSpecificCredentialStoreToken())) {
+			return gatewayComputeResourcePreference.getResourceSpecificCredentialStoreToken();
+		} else {
+			return gatewayResourceProfile.getCredentialStoreToken();
+		}
+	}
+
+	public JobSubmissionProtocol getPreferredJobSubmissionProtocol(){
+		return gatewayComputeResourcePreference.getPreferredJobSubmissionProtocol();
+	}
+
+	public DataMovementProtocol getPreferredDataMovementProtocol() {
+		return gatewayComputeResourcePreference.getPreferredDataMovementProtocol();
 	}
 
 	public void setMonitorMode(MonitorMode monitorMode) {
@@ -529,6 +576,72 @@ public class ProcessContext {
 		this.recoveryWithCancel = recoveryWithCancel;
 	}
 
+	public boolean isUseUserCRPref() {
+		return getProcessModel().isUseUserCRPref();
+	}
 
+	public String getLoginUserName(){
+		if (isUseUserCRPref() && isValid(userComputeResourcePreference.getLoginUserName())) {
+			return userComputeResourcePreference.getLoginUserName();
+		} else if (isValid(processModel.getProcessResourceSchedule().getOverrideLoginUserName())) {
+			return processModel.getProcessResourceSchedule().getOverrideLoginUserName();
+		} else {
+			return gatewayComputeResourcePreference.getLoginUserName();
+		}
+	}
+
+	private boolean isValid(String str) {
+		return str != null && !str.trim().isEmpty();
+	}
+
+	public String getUsageReportingGatewayId() {
+		return gatewayComputeResourcePreference.getUsageReportingGatewayId();
+	}
+
+	public String getAllocationProjectNumber() {
+		return gatewayComputeResourcePreference.getAllocationProjectNumber();
+	}
+
+	public String getReservation() {
+		long start, end ;
+		String reservation = null;
+		if (isUseUserCRPref() && isValid(userComputeResourcePreference.getReservation())) {
+			reservation = userComputeResourcePreference.getReservation();
+			start = userComputeResourcePreference.getReservationStartTime();
+			end = userComputeResourcePreference.getReservationEndTime();
+		}else {
+			reservation = gatewayComputeResourcePreference.getReservation();
+			start = gatewayComputeResourcePreference.getReservationStartTime();
+			end = gatewayComputeResourcePreference.getReservationEndTime();
+		}
+		if (start > 0 && start < end) {
+			long now = Calendar.getInstance().getTimeInMillis();
+			if (now > start && now < end) {
+				return reservation;
+			}
+		} else {
+			return reservation;
+		}
+		return reservation;
+	}
+
+	public String getQualityOfService() {
+		if (isUseUserCRPref() && isValid(userComputeResourcePreference.getQualityOfService())) {
+			return userComputeResourcePreference.getQualityOfService();
+		} else {
+			return gatewayComputeResourcePreference.getQualityOfService();
+		}
+	}
+
+
+	public String getQueueName() {
+		if (isUseUserCRPref() && isValid(userComputeResourcePreference.getPreferredBatchQueue())) {
+			return userComputeResourcePreference.getPreferredBatchQueue();
+		} else if (isValid(processModel.getProcessResourceSchedule().getQueueName())) {
+			return processModel.getProcessResourceSchedule().getQueueName();
+		} else {
+			return gatewayComputeResourcePreference.getPreferredBatchQueue();
+		}
+	}
 }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
index 5e8de6d..ac40c80 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
@@ -262,7 +262,7 @@ public abstract class Factory {
             AuthenticationInfo authentication = remoteCluster.getAuthentication();
             if (authentication instanceof SSHKeyAuthentication){
                 SSHKeyAuthentication sshKeyAuthentication = (SSHKeyAuthentication)authentication;
-                if (!sshKeyAuthentication.getUserName().equals(getLoginUserName(processContext))){
+                if (!sshKeyAuthentication.getUserName().equals(processContext.getLoginUserName())){
                     JobManagerConfiguration jobManagerConfiguration =
 							getJobManagerConfiguration(processContext.getResourceJobManager());
                     if (jobSubmissionProtocol == JobSubmissionProtocol.SSH ||
@@ -301,7 +301,7 @@ public abstract class Factory {
             AuthenticationInfo authentication = remoteCluster.getAuthentication();
             if (authentication instanceof SSHKeyAuthentication){
                 SSHKeyAuthentication sshKeyAuthentication = (SSHKeyAuthentication)authentication;
-                if (!sshKeyAuthentication.getUserName().equals(getLoginUserName(processContext))){
+                if (!sshKeyAuthentication.getUserName().equals(processContext.getLoginUserName())){
                     JobManagerConfiguration jobManagerConfiguration =
 							getJobManagerConfiguration(processContext.getResourceJobManager());
                     dataMovementProtocol = processContext.getDataMovementProtocol();
@@ -318,13 +318,7 @@ public abstract class Factory {
 
 	public static SSHKeyAuthentication getComputerResourceSSHKeyAuthentication(ProcessContext pc) throws GFacException {
         try {
-            ComputeResourcePreference computeResourcePreference = pc.getComputeResourcePreference();
-            String loginUserName = getLoginUserName(pc);
-            String credentialStoreToken = computeResourcePreference.getResourceSpecificCredentialStoreToken();
-            if (credentialStoreToken == null || credentialStoreToken.isEmpty()) {
-                credentialStoreToken = pc.getGatewayResourceProfile().getCredentialStoreToken();
-            }
-            return getSshKeyAuthentication(pc.getGatewayId(),loginUserName, credentialStoreToken);
+            return getSshKeyAuthentication(pc.getGatewayId(),pc.getLoginUserName(), pc.getCredentialToken());
         } catch (ApplicationSettingsException | IllegalAccessException | InstantiationException | CredentialStoreException e) {
             throw new GFacException("Couldn't build ssh authentication object", e);
         }
@@ -344,40 +338,6 @@ public abstract class Factory {
         }
     }
 
-    public static String  getLoginUserName(ProcessContext processContext) throws GFacException {
-        try {
-            ProcessModel processModel = processContext.getProcessModel();
-            String loginUserName = null;
-            String overrideLoginUserName = processModel.getProcessResourceSchedule().getOverrideLoginUserName();
-            if (overrideLoginUserName != null && !overrideLoginUserName.equals("")) {
-                loginUserName = overrideLoginUserName;
-            } else {
-                loginUserName = processContext.getComputeResourcePreference().getLoginUserName();
-            }
-
-            return loginUserName;
-        }  catch (Exception e) {
-            throw new GFacException("Couldn't fetch loginUserName", e);
-        }
-    }
-
-    public static String  getScratchLocation(ProcessContext processContext) throws GFacException {
-        try {
-            ProcessModel processModel = processContext.getProcessModel();
-            String scratchLocation = null;
-            String overrideScratchLocation = processModel.getProcessResourceSchedule().getOverrideScratchLocation();
-            if (overrideScratchLocation != null && !overrideScratchLocation.equals("")) {
-                scratchLocation = overrideScratchLocation;
-            } else {
-                scratchLocation = processContext.getComputeResourcePreference().getScratchLocation();
-            }
-
-            return scratchLocation;
-        }  catch (Exception e) {
-            throw new GFacException("Couldn't fetch scratchLocation", e);
-        }
-    }
-
     private static SSHKeyAuthentication getSshKeyAuthentication(String gatewayId,
                                                                 String loginUserName,
                                                                 String credentialStoreToken)

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/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 71750b3..d94580c 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
@@ -45,6 +45,8 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePrefer
 import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
 import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
 import org.apache.airavata.model.application.io.DataType;
 import org.apache.airavata.model.application.io.InputDataObjectType;
 import org.apache.airavata.model.application.io.OutputDataObjectType;
@@ -101,15 +103,17 @@ public class GFacEngineImpl implements GFacEngine {
                         processContext.getExperimentId(), processContext.getProcessId());
             }
 
-            GatewayResourceProfile gatewayProfile = appCatalog.getGatewayProfile().getGatewayProfile(gatewayId);
-            processContext.setGatewayResourceProfile(gatewayProfile);
-            ComputeResourcePreference computeResourcePreference = appCatalog.getGatewayProfile().getComputeResourcePreference
-                    (gatewayId, processModel.getComputeResourceId());
+            setGatewayResourceProfile(gatewayId, processContext);
+            setGatewayComputeResourcePreference(gatewayId, processContext);
+            if (processModel.isUseUserCRPref()) {
+                setUserResourceProfile(gatewayId, processContext);
+                setUserComputeResourcePreference(gatewayId, processContext);
+            }
             //FIXME: Temporary revert, this needs a proper fix.
 //            String scratchLocation = Factory.getScratchLocation(processContext);
-            String scratchLocation = computeResourcePreference.getScratchLocation();
+
+            String scratchLocation = processContext.getScratchLocation();
             scratchLocation = scratchLocation + File.separator + processId + File.separator;
-            processContext.setComputeResourcePreference(computeResourcePreference);
             StoragePreference storagePreference = appCatalog.getGatewayProfile().getStoragePreference(gatewayId, processModel.getStorageResourceId());
             StorageResourceDescription storageResource = appCatalog.getStorageResource().getStorageResource(processModel.getStorageResourceId());
             if (storageResource != null){
@@ -138,7 +142,7 @@ public class GFacEngineImpl implements GFacEngine {
                 processContext.setStorageResource(storageResource);
             }*/
             processContext.setComputeResourceDescription(appCatalog.getComputeResource().getComputeResource
-                    (processContext.getComputeResourcePreference().getComputeResourceId()));
+                    (processContext.getComputeResourceId()));
             processContext.setApplicationDeploymentDescription(appCatalog.getApplicationDeployment()
                     .getApplicationDeployement(processModel.getApplicationDeploymentId()));
             ApplicationInterfaceDescription applicationInterface = appCatalog.getApplicationInterface()
@@ -146,7 +150,7 @@ public class GFacEngineImpl implements GFacEngine {
             processContext.setApplicationInterfaceDescription(applicationInterface);
             String computeResourceId = processContext.getComputeResourceDescription().getComputeResourceId();
             String hostName = Factory.getDefaultAppCatalog().getComputeResource().getComputeResource(computeResourceId).getHostName();
-            ServerInfo serverInfo = new ServerInfo(Factory.getLoginUserName(processContext), hostName);
+            ServerInfo serverInfo = new ServerInfo(processContext.getLoginUserName(), hostName);
             processContext.setServerInfo(serverInfo);
             List<OutputDataObjectType> applicationOutputs = applicationInterface.getApplicationOutputs();
             if (applicationOutputs != null && !applicationOutputs.isEmpty()) {
@@ -220,6 +224,42 @@ public class GFacEngineImpl implements GFacEngine {
 
     }
 
+    private void setGatewayComputeResourcePreference(String gatewayId, ProcessContext processContext) throws AppCatalogException {
+        AppCatalog appCatalog = processContext.getAppCatalog();
+        ProcessModel processModel = processContext.getProcessModel();
+        ComputeResourcePreference computeResourcePreference =
+                appCatalog.getGatewayProfile().getComputeResourcePreference(gatewayId, processModel.getComputeResourceId());
+        processContext.setGatewayComputeResourcePreference(computeResourcePreference);
+    }
+
+    private void setGatewayResourceProfile(String gatewayId, ProcessContext processContext) throws AppCatalogException {
+        AppCatalog appCatalog = processContext.getAppCatalog();
+        GatewayResourceProfile gatewayProfile = appCatalog.getGatewayProfile().getGatewayProfile(gatewayId);
+        processContext.setGatewayResourceProfile(gatewayProfile);
+    }
+
+    private void setUserResourceProfile(String gatewayId, ProcessContext processContext) throws AppCatalogException {
+        AppCatalog appCatalog = processContext.getAppCatalog();
+        ProcessModel processModel = processContext.getProcessModel();
+
+        UserResourceProfile userResourceProfile =
+                appCatalog.getUserResourceProfile()
+                        .getUserResourceProfile(processModel.getUserName(), gatewayId);
+
+        processContext.setUserResourceProfile(userResourceProfile);
+    }
+
+    private void setUserComputeResourcePreference(String gatewayId, ProcessContext processContext) throws AppCatalogException {
+        AppCatalog appCatalog = processContext.getAppCatalog();
+        ProcessModel processModel = processContext.getProcessModel();
+        UserComputeResourcePreference userComputeResourcePreference =
+                appCatalog.getUserResourceProfile().getUserComputeResourcePreference(
+                        processModel.getUserName(),
+                        gatewayId,
+                        processModel.getComputeResourceId());
+        processContext.setUserComputeResourcePreference(userComputeResourcePreference);
+    }
+
     private void checkRecoveryWithCancel(ProcessContext processContext) throws Exception {
         CuratorFramework curatorClient = processContext.getCuratorClient();
         String experimentId = processContext.getExperimentId();
@@ -364,7 +404,7 @@ public class GFacEngineImpl implements GFacEngine {
                                         submodel.setType(DataStageType.OUPUT);
                                         submodel.setProcessOutput(output);
                                         URI source = new URI(processContext.getDataMovementProtocol().name(),
-                                                Factory.getLoginUserName(processContext),
+                                                processContext.getLoginUserName(),
                                                 processContext.getComputeResourceDescription().getHostName(),
                                                 22,
                                                 processContext.getWorkingDir() + output.getValue(), null, null);

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
index 657de00..97956bd 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
@@ -168,7 +168,7 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
                         String loadCommand = computeResourceDescription.getGatewayUsageModuleLoadCommand();
                         String usageExecutable = computeResourceDescription.getGatewayUsageExecutable();
                         ExperimentModel experiment = (ExperimentModel)taskContext.getParentProcessContext().getExperimentCatalog().get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
-                        String username = experiment.getUserName() + "@" + taskContext.getParentProcessContext().getComputeResourcePreference().getUsageReportingGatewayId();
+                        String username = experiment.getUserName() + "@" + taskContext.getParentProcessContext().getUsageReportingGatewayId();
                         RawCommandInfo rawCommandInfo = new RawCommandInfo(loadCommand + " && " + usageExecutable + " -gateway_user " +  username  +
                                                                            " -submit_time \"`date '+%F %T %:z'`\"  -jobid " + jobId );
                         remoteCluster.execute(rawCommandInfo);

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/JSDLGenerator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/JSDLGenerator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/JSDLGenerator.java
index 3403240..d30f383 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/JSDLGenerator.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/JSDLGenerator.java
@@ -101,8 +101,8 @@ public class JSDLGenerator implements BESConstants {
 	private static void createJobIdentification(JobDefinitionType value, ProcessContext context) {
 
 		if (context != null) {
-			if (context.getComputeResourcePreference() != null && context.getComputeResourcePreference().getAllocationProjectNumber() != null)
-				JSDLUtils.addProjectName(value, context.getComputeResourcePreference().getAllocationProjectNumber());
+			if (context.getAllocationProjectNumber() != null)
+				JSDLUtils.addProjectName(value, context.getAllocationProjectNumber());
 			
 			if (context.getApplicationInterfaceDescription() != null && context.getApplicationInterfaceDescription().getApplicationDescription() != null)
 				JSDLUtils.getOrCreateJobIdentification(value).setDescription(context.getApplicationInterfaceDescription().getApplicationDescription());
@@ -112,4 +112,5 @@ public class JSDLGenerator implements BESConstants {
 		}
 	}
 
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
index 5599a4b..9b8ab09 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
@@ -284,6 +284,7 @@ public class ExperimentRegistry {
             processResource.setGenerateCert(process.isGenerateCert());
             processResource.setExperimentDataDir(process.getExperimentDataDir());
             processResource.setUserName(process.getUserName());
+            processResource.setUseUserCRPref(process.isUseUserCRPref());
             if(process.isEnableEmailNotification()){
                 processResource.setEnableEmailNotification(true);
                 if(process.getEmailAddresses() != null){
@@ -750,6 +751,7 @@ public class ExperimentRegistry {
             processResource.setGenerateCert(process.isGenerateCert());
             processResource.setExperimentDataDir(process.getExperimentDataDir());
             processResource.setUserName(process.getUserName());
+            processResource.setUseUserCRPref(process.isUseUserCRPref());
             if(process.isEnableEmailNotification()){
                 processResource.setEnableEmailNotification(true);
                 if(process.getEmailAddresses() != null){
@@ -1074,7 +1076,7 @@ public class ExperimentRegistry {
             ExperimentResource experimentResource = new ExperimentResource();
             ProcessResource resource = experimentResource.getProcess(processId);
             if (fieldName == null) {
-                return ThriftDataModelConversion.getProcesModel(resource);
+                return ThriftDataModelConversion.getProcessModel(resource);
             } else if (fieldName.equals(Constants.FieldConstants.ProcessConstants.PROCESS_ERROR)) {
                 return ThriftDataModelConversion.getErrorModel(resource.getProcessError());
             } else if (fieldName.equals(Constants.FieldConstants.ProcessConstants.PROCESS_STATUS)) {
@@ -1214,7 +1216,7 @@ public class ExperimentRegistry {
                 experimentResource.setExperimentId((String) value);
                 List<ProcessResource> resources = experimentResource.getProcessList();
                 for (ProcessResource processResource : resources) {
-                    ProcessModel processModel = ThriftDataModelConversion.getProcesModel(processResource);
+                    ProcessModel processModel = ThriftDataModelConversion.getProcessModel(processResource);
                     processes.add(processModel);
                 }
                 return processes;

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Process.java
----------------------------------------------------------------------
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 3ea2150..80528ef 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 @@ public class Process {
     private Collection<Task> tasks;
     private String userDn;
     private boolean generateCert;
+    private boolean useUserCRPref;
 
     @Id
     @Column(name = "PROCESS_ID")
@@ -311,4 +312,13 @@ public class Process {
     public void setTasks(Collection<Task> taskByProcessId) {
         this.tasks = taskByProcessId;
     }
+
+    @Column(name = "USE_USER_CR_PREF")
+    public boolean isUseUserCRPref() {
+        return useUserCRPref;
+    }
+
+    public void setUseUserCRPref(boolean useUserCRPref) {
+        this.useUserCRPref = useUserCRPref;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
----------------------------------------------------------------------
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 c0c974d..aa16460 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
@@ -57,6 +57,7 @@ public class ProcessResource extends AbstractExpCatResource {
     private String userName;
     private boolean generateCert;
     private String experimentDataDir;
+    private boolean useUserCRPref;
 
     public String getProcessId() {
         return processId;
@@ -194,6 +195,14 @@ public class ProcessResource extends AbstractExpCatResource {
         this.userName = userName;
     }
 
+    public boolean isUseUserCRPref() {
+        return useUserCRPref;
+    }
+
+    public void setUseUserCRPref(boolean useUserCRPref) {
+        this.useUserCRPref = useUserCRPref;
+    }
+
     public ExperimentCatResource create(ResourceType type) throws RegistryException{
        switch (type){
            case PROCESS_ERROR:
@@ -600,6 +609,8 @@ public class ProcessResource extends AbstractExpCatResource {
             process.setGenerateCert(generateCert);
             process.setExperimentDataDir(experimentDataDir);
             process.setUserName(userName);
+            process.setUseUserCRPref(useUserCRPref);
+
             if (existingProcess == null){
                 em.persist(process);
             }else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
----------------------------------------------------------------------
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 2c36442..2f5ff99 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
@@ -582,6 +582,7 @@ public class Utils {
             processResource.setGenerateCert(o.getGenerateCert());
             processResource.setExperimentDataDir(o.getExperimentDataDir());
             processResource.setUserName(o.getUserName());
+            processResource.setUseUserCRPref(o.isUseUserCRPref());
         }
         return processResource;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/3660cd8f/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
index a498de5..f84b3d8 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
@@ -359,7 +359,7 @@ public class ThriftDataModelConversion {
         return null;
     }
 
-    public static ProcessModel getProcesModel (ProcessResource processResource) throws RegistryException {
+    public static ProcessModel getProcessModel(ProcessResource processResource) throws RegistryException {
         if (processResource != null){
             ProcessModel processModel = new ProcessModel();
             processModel.setProcessId(processResource.getProcessId());
@@ -374,6 +374,7 @@ public class ThriftDataModelConversion {
             processModel.setComputeResourceId(processResource.getComputeResourceId());
             processModel.setEnableEmailNotification(processResource.getEnableEmailNotification());
             processModel.setExperimentDataDir(processResource.getExperimentDataDir());
+            processModel.setUseUserCRPref(processResource.isUseUserCRPref());
             if (processModel.isEnableEmailNotification()){
                 String notificationEmails = processResource.getEmailAddresses();
                 processModel.setEmailAddresses(getEmailAddresses(notificationEmails.split(",")));


Mime
View raw message