You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2017/05/16 15:13:00 UTC

airavata-php-gateway git commit: using custom node/cpu/walltime in experiment edit

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop a90d50df0 -> 5ea6293c7


using custom node/cpu/walltime in experiment edit


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/5ea6293c
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/5ea6293c
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/5ea6293c

Branch: refs/heads/develop
Commit: 5ea6293c78a98d59c3de8b211152fac73decf83c
Parents: a90d50d
Author: scnakandala <su...@gmail.com>
Authored: Tue May 16 11:12:55 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Tue May 16 11:12:55 2017 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php | 58 ++++++++++++++++++++++++---
 1 file changed, 52 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5ea6293c/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 11849ad..19f929c 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -274,16 +274,62 @@ class ExperimentController extends BaseController
 
     public function editView()
     {
-        $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"]
-        );
-
         $experiment = ExperimentUtilities::get_experiment($_GET['expId']);
         $expVal = ExperimentUtilities::get_experiment_values($experiment);
         $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment);
 
+
+        $appInterfaces = AppUtilities::get_all_applications();
+        foreach($appInterfaces as $id=>$name) {
+            if ($id == $experiment->executionId) {
+                $appId = AppUtilities::get_application_interface($id)->applicationModules[0];
+            }
+        }
+
+        $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"];
+
+
+        $computeResourceId = $experiment->userConfigurationData->computationalResourceScheduling->resourceHostId;
+        $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;
+        }
+
+        $appDeployments = Airavata::getAllApplicationDeployments(Session::get('authz-token'), Session::get("gateway_id"));
+        $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;
+            }
+        }
+
+        $queueDefaults = array("queueName" => Config::get('pga_config.airavata')["queue-name"],
+            "nodeCount" => $nodeCount,
+            "cpuCount" => $cpuCount,
+            "wallTimeLimit" => $wallTimeLimit
+        );
+
         $computeResources = CRUtilities::create_compute_resources_select($experiment->executionId, $expVal['scheduling']->resourceHostId);
 
         $userComputeResourcePreferences = URPUtilities::get_all_user_compute_resource_prefs();