Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 8693429f8 -> a90d50df0


using default app/node/wall times from compute resource and app deployments 
when creating the experiment


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

Branch: refs/heads/develop
Commit: a90d50df00d3979f13a7f48677d4c4179bc99261
Parents: 8693429
Author: scnakandala <[email protected]>
Authored: Mon May 15 17:57:07 2017 -0400
Committer: scnakandala <[email protected]>
Committed: Mon May 15 17:57:07 2017 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php | 51 +++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a90d50df/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php 
b/app/controllers/ExperimentController.php
index fc29584..11849ad 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -27,6 +27,7 @@ class ExperimentController extends BaseController
 
     public function createView()
     {
+        Session::forget('exp_create_app_id');
         Session::forget('exp_create_continue');
         return View::make('experiment/create');
     }
@@ -35,6 +36,12 @@ class ExperimentController extends BaseController
     {
         if (isset($_POST['continue'])) {
             Session::put('exp_create_continue', true);
+            $appInterfaces = AppUtilities::get_all_applications();
+            foreach($appInterfaces as $id=>$name){
+                if($id == $_POST['application']){
+                    Session::put('exp_create_app_id', 
AppUtilities::get_application_interface($id)->applicationModules[0]);
+                }
+            }
 
             $computeResources = 
CRUtilities::create_compute_resources_select($_POST['application'], null);
 
@@ -399,12 +406,50 @@ class ExperimentController extends BaseController
 
     public function getQueueView()
     {
+        $appId = Session::get('exp_create_app_id');
         $computeResourceId = Input::get("crId");
+        $appDeployments = 
Airavata::getAllApplicationDeployments(Session::get('authz-token'), 
Session::get("gateway_id"));
+
+        $nodeCount = Config::get('pga_config.airavata')["node-count"];
+        $cpuCount = Config::get('pga_config.airavata')["total-cpu-count"];
+        $wallTimeLimit = Config::get('pga_config.airavata')["wall-time-limit"];
+
+        $crResource = CRUtilities::get_compute_resource($computeResourceId);
+        if($crResource->defaultNodeCount > 0){
+            $nodeCount = $crResource->defaultNodeCount;
+        }
+        if($crResource->defaultCPUCount > 0){
+            $cpuCount = $crResource->defaultCPUCount;
+        }
+        if($crResource->defaultWalltime > 0){
+            $wallTimeLimit = $crResource->defaultWalltime;
+        }
+
+        $correctAppDeployment = null;
+        foreach($appDeployments as $appDeployment){
+            if($appDeployment->computeHostId == $computeResourceId && 
$appDeployment->appModuleId == $appId){
+                $correctAppDeployment = $appDeployment;
+                break;
+            }
+        }
+
+        if($correctAppDeployment != null){
+            if($correctAppDeployment->defaultNodeCount > 0){
+
+            }
+            if($correctAppDeployment->defaultCPUCount > 0){
+                $cpuCount = $correctAppDeployment->defaultCPUCount;
+            }
+            if($correctAppDeployment->defaultWalltime > 0) {
+                $wallTimeLimit = $correctAppDeployment->defaultWalltime;
+            }
+        }
+
         $queues = 
ExperimentUtilities::getQueueDatafromResourceId($computeResourceId);
         $queueDefaults = array("queueName" => 
Config::get('pga_config.airavata')["queue-name"],
-            "nodeCount" => Config::get('pga_config.airavata')["node-count"],
-            "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
-            "wallTimeLimit" => 
Config::get('pga_config.airavata')["wall-time-limit"]
+            "nodeCount" => $nodeCount,
+            "cpuCount" => $cpuCount,
+            "wallTimeLimit" => $wallTimeLimit
         );
 
         $userComputeResourcePreferences = 
URPUtilities::get_all_user_compute_resource_prefs();

Reply via email to