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 2016/04/23 04:08:10 UTC

[13/23] airavata-php-gateway git commit: fixes added for connected issues - AIRAVATA-1952 + AIRAVATA-1951 + AIRAVATA-1926

fixes added for connected issues - AIRAVATA-1952 + AIRAVATA-1951 + AIRAVATA-1926


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

Branch: refs/heads/master
Commit: f5092180881422d2cbe59e5f2df518135c49cc31
Parents: cb39e6e
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Fri Apr 15 15:31:44 2016 -0400
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Fri Apr 15 15:31:44 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php        | 29 +++++-----
 app/libraries/ExperimentUtilities.php           | 56 +++++++++++---------
 app/libraries/ProjectUtilities.php              |  4 +-
 app/views/partials/experiment-info.blade.php    |  6 +--
 app/views/partials/experiment-inputs.blade.php  | 11 ++--
 .../partials/experiment-queue-block.blade.php   | 10 ++--
 app/views/project/summary.blade.php             |  2 +-
 7 files changed, 63 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 7df7cf7..f5ca6ea 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -34,16 +34,17 @@ class ExperimentController extends BaseController
             Session::put('exp_create_continue', true);
 
             $computeResources = CRUtilities::create_compute_resources_select($_POST['application'], null);
-
             $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"]
             );
 
-            $clonedExp = false;
+            $clonedExp = false; $savedExp = false;
             if( Input::has("clonedExp"))
                 $clonedExp = true;
+            if( Input::has("savedExp"))
+                $savedExp = true;
 
             // Condition added to deal with php ini default value set for post_max_size issue.
             $allowedFileSize = Config::get('pga_config.airavata')["server-allowed-file-size"];
@@ -51,8 +52,10 @@ class ExperimentController extends BaseController
             if( $serverLimit < $allowedFileSize)
                 $allowedFileSize = $serverLimit;
 
+            
             $experimentInputs = array(
                 "clonedExp" => $clonedExp,
+                "savedExp" => $savedExp,
                 "disabled" => ' disabled',
                 "experimentName" => $_POST['experiment-name'],
                 "experimentDescription" => $_POST['experiment-description'] . ' ',
@@ -111,7 +114,7 @@ class ExperimentController extends BaseController
 
         
             $project = ProjectUtilities::get_project($experiment->projectId);
-            $expVal = ExperimentUtilities::get_experiment_values($experiment, $project);
+            $expVal = ExperimentUtilities::get_experiment_values($experiment);
             $jobDetails = ExperimentUtilities::get_job_details($experiment->experimentId);
             //var_dump( $jobDetails); exit;
             foreach( $jobDetails as $index => $jobDetail){
@@ -168,9 +171,7 @@ class ExperimentController extends BaseController
     {
         //var_dump( Input::all() ); exit;
         $experiment = ExperimentUtilities::get_experiment(Input::get('expId'));
-        $project = ProjectUtilities::get_project($experiment->projectId);
-
-        $expVal = ExperimentUtilities::get_experiment_values($experiment, $project);
+        $expVal = ExperimentUtilities::get_experiment_values($experiment);
         $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment);
         /*if (isset($_POST['save']))
         {
@@ -197,19 +198,20 @@ class ExperimentController extends BaseController
         );
 
         $experiment = ExperimentUtilities::get_experiment($_GET['expId']);
-        $project = ProjectUtilities::get_project($experiment->projectId);
-
-        $expVal = ExperimentUtilities::get_experiment_values($experiment, $project);
+        $expVal = ExperimentUtilities::get_experiment_values($experiment);
         $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment);
 
         $computeResources = CRUtilities::create_compute_resources_select($experiment->executionId, $expVal['scheduling']->resourceHostId);
 
-        $clonedExp = false;
+        $clonedExp = false; $savedExp = false;
         if( Input::has("clonedExp"))
             $clonedExp = true;
+        if( Input::has("savedExp"))
+            $savedExp = true;
 
         $experimentInputs = array(
             "clonedExp" => $clonedExp,
+            "savedExp" => $savedExp,
             "disabled" => ' ',
             "experimentName" => $experiment->experimentName,
             "experimentDescription" => $experiment->description,
@@ -219,12 +221,9 @@ class ExperimentController extends BaseController
             "allowedFileSize" => Config::get('pga_config.airavata')["server-allowed-file-size"],
             'experiment' => $experiment,
             "queueDefaults" => $queueDefaults,
-            'project' => $project,
-            'expVal' => $expVal,
-            'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"],
             'computeResources' => $computeResources,
             "resourceHostId" => $expVal['scheduling']->resourceHostId,
-            'project' => $project,
+            'project' => $experiment->projectId,
             'expVal' => $expVal,
             'cloning' => true,
             'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"]
@@ -239,7 +238,7 @@ class ExperimentController extends BaseController
             $experiment = ExperimentUtilities::get_experiment($cloneId);
             $project = ProjectUtilities::get_project($experiment->projectId);
 
-            $expVal = ExperimentUtilities::get_experiment_values($experiment, $project);
+            $expVal = ExperimentUtilities::get_experiment_values($experiment);
             $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment);
 
             return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index a0be1f6..fd28303 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -73,31 +73,35 @@ class ExperimentUtilities
             $order[$index] = $input->inputOrder;
         }
         array_multisort($order, SORT_ASC, $experimentInputs);
-        foreach ($experimentInputs as $input) {
-            $matchingAppInput = null;
+        if( count( $experimentInputs) > 0 ) { 
+            echo '<h3>Saved Inputs</strong></h3>';
+            foreach ($experimentInputs as $input) {
+                $matchingAppInput = null;
 
-            if ($input->type == DataType::URI) {
-                $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
-                if(!ExperimentUtilities::endsWith($dataRoot, "/"))
-                    $dataRoot = $dataRoot . "/";
-                if(strpos($input->value, "airavata-dp") === 0){
-                    $dataProductModel = Airavata::getDataProduct(Session::get('authz-token'), $input->value);
-                    $currentInputPath = "";
-                    foreach ($dataProductModel->replicaLocations as $rp) {
-                        if($rp->replicaLocationCategory == ReplicaLocationCategory::GATEWAY_DATA_STORE){
-                            $currentInputPath = $rp->filePath;
-                            break;
+                if ($input->type == DataType::URI) {
+                    $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
+                    if(!ExperimentUtilities::endsWith($dataRoot, "/"))
+                        $dataRoot = $dataRoot . "/";
+                    if(strpos($input->value, "airavata-dp") === 0){
+                        $dataProductModel = Airavata::getDataProduct(Session::get('authz-token'), $input->value);
+                        $currentInputPath = "";
+                        foreach ($dataProductModel->replicaLocations as $rp) {
+                            if($rp->replicaLocationCategory == ReplicaLocationCategory::GATEWAY_DATA_STORE){
+                                $currentInputPath = $rp->filePath;
+                                break;
+                            }
                         }
+                        $filePath = str_replace($dataRoot, "", parse_url($currentInputPath, PHP_URL_PATH));
+                    }else{
+                        $filePath = str_replace($dataRoot, "", parse_url($input->value, PHP_URL_PATH));
                     }
-                    $filePath = str_replace($dataRoot, "", parse_url($currentInputPath, PHP_URL_PATH));
-                }else{
-                    $filePath = str_replace($dataRoot, "", parse_url($input->value, PHP_URL_PATH));
+
+                    echo '<p>' . $input->name . ':&nbsp;<a target="_blank" href="' . URL::to("/") . '/download/?path='
+                        . $filePath . '">' . basename($filePath) . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+                } elseif ($input->type == DataType::STRING || $input->type == DataType::INTEGER
+                    || $input->type == DataType::FLOAT) {
+                    echo '<p>' . $input->name . ':&nbsp;' . $input->value . '</p>';
                 }
-                echo '<p>' . $input->name . ':&nbsp;<a target="_blank" href="' . URL::to("/") . '/download/?path='
-                    . $filePath . '">' . basename($filePath) . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
-            } elseif ($input->type == DataType::STRING || $input->type == DataType::INTEGER
-                || $input->type == DataType::FLOAT) {
-                echo '<p>' . $input->name . ':&nbsp;' . $input->value . '</p>';
             }
         }
     }
@@ -497,11 +501,11 @@ class ExperimentUtilities
             //create new experiment to receive the clone
             $experiment = Airavata::getExperiment(Session::get('authz-token'), $expId);
             $cloneId = Airavata::cloneExperiment(Session::get('authz-token'), $expId, 'Clone of ' . $experiment->experimentName);
-
             //updating the experiment inputs and output path
             $experiment = Airavata::getExperiment(Session::get('authz-token'), $cloneId);
             $experimentInputs = $experiment->experimentInputs;
             ExperimentUtilities::create_experiment_folder_path($experiment->projectId, $experiment->experimentName);
+
             $hostName = $_SERVER['SERVER_NAME'];
 
             foreach ($experimentInputs as $experimentInput) {
@@ -823,7 +827,7 @@ class ExperimentUtilities
     }
     */
 
-    public static function get_experiment_values($experiment, $project, $forSearch = false)
+    public static function get_experiment_values($experiment, $forSearch = false)
     {
         $expVal = array();
         //$expVal["experimentStatusString"] = "";
@@ -1072,7 +1076,7 @@ class ExperimentUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectId), true);
+            $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;
@@ -1149,7 +1153,7 @@ class ExperimentUtilities
     {
         $experiment->experimentName = $input['experiment-name'];
         $experiment->description = rtrim($input['experiment-description']);
-        $experiment->projectId = $input['project'];
+//        $experiment->projectId = $input['project'];
 //        $experiment->applicationId = $_POST['application'];
 //        $experiment->executionId = $_POST['application'];
 
@@ -1191,7 +1195,7 @@ class ExperimentUtilities
         $applicationInputs = AppUtilities::get_application_inputs($experiment->executionId);
 
         $experimentInputs = $experiment->experimentInputs; // get current inputs
-        $experimentInputs = ExperimentUtilities::process_inputs($input['project'], $input['experiment-name'], $applicationInputs, $experimentInputs); // get new inputs
+        $experimentInputs = ExperimentUtilities::process_inputs( $experiment->projectId, $input['experiment-name'], $applicationInputs, $experimentInputs); // get new inputs
 
         if ($experimentInputs) {
             $experiment->experimentInputs = $experimentInputs;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
index 2c04f51..2e2dd70 100644
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -75,10 +75,10 @@ class ProjectUtilities
      */
     public static function create_project_select($projectId = null, $editable = true)
     {
-        $editable ? $readonly = '' : $readonly = 'readonly';
+        $editable ? $disabled = '' : $disabled = 'disabled';
         $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username'));
 
-        echo '<select class="form-control" name="project" id="project" required ' . $readonly . '>';
+        echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>';
         if (sizeof($userProjects) > 0) {
             foreach ($userProjects as $project) {
                 if ($project->projectID == $projectId) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 7a13711..9b17c17 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -197,7 +197,7 @@
             <a id="cancel_exp_link" href="{{URL::to('/') }}/experiment/cancel?expId={{ $experiment->experimentId }}"
                class="btn btn-default" onclick="return confirm('Are you sure you want to cancel this experiment?')"
                role="button"
-               title="Edit the experiment's settings" @if (!$expVal["cancelable"]) style="display: none" @endif>
+               title="Cancel experiment" @if (!$expVal["cancelable"]) style="display: none" @endif>
                 <input name="cancel" type="submit" class="btn btn-warning"
                        value="Cancel" <?php if (!$expVal["cancelable"]) echo 'disabled'; ?> >
             </a>
@@ -216,10 +216,10 @@
                 Clone
             </a>
             <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
-            <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentId }}"
+            <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentId }}&savedExp=true"
                class="btn btn-default"
                role="button"
-               title="Edit the experiment's settings" <?php if (!$expVal["editable"]) echo 'style="display: none"' ?>>
+               title="Edit experiment" <?php if (!$expVal["editable"]) echo 'style="display: none"' ?>>
                 <span class="glyphicon glyphicon-pencil"></span>
                 Edit
             </a>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/views/partials/experiment-inputs.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-inputs.blade.php b/app/views/partials/experiment-inputs.blade.php
index 5307938..8be156b 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -14,7 +14,11 @@
 </div>
 <div class="form-group required">
     <label for="project" class="control-label">Project</label>
-    {{ ProjectUtilities::create_project_select($expInputs['project'], !$expInputs['clonedExp']) }}
+    @if( $expInputs["clonedExp"] || $expInputs["savedExp"])
+        {{ ProjectUtilities::create_project_select($expInputs["project"], false) }}
+    @else
+        {{ ProjectUtilities::create_project_select($expInputs["project"], true) }}
+    @endif
 </div>
 <div class="form-group">
     <label for="application">Application</label>
@@ -27,11 +31,12 @@
         <label>Application input</label>
 
         <div class="well">
-            @if( $expInputs["clonedExp"])
             <div class="form-group">
-                <p><strong>Current inputs</strong></p>
                 {{ ExperimentUtilities::list_input_files($expInputs['experiment']->experimentInputs) }}
+                <hr/>
             </div>
+            <h3>Enter Experiment Inputs</h3>
+            @if( $expInputs["clonedExp"] || $expInputs["savedExp"])
             {{ ExperimentUtilities::create_inputs($expInputs['application'], false) }}
             @else
             {{ ExperimentUtilities::create_inputs($expInputs['application'], true) }}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/views/partials/experiment-queue-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-queue-block.blade.php b/app/views/partials/experiment-queue-block.blade.php
index c585ea2..ac3e0ac 100644
--- a/app/views/partials/experiment-queue-block.blade.php
+++ b/app/views/partials/experiment-queue-block.blade.php
@@ -26,7 +26,7 @@
         <input type="number" class="form-control" name="node-count" id="node-count" min="1"
                value="@if(isset($expVal) ){{ $expVal['scheduling']->nodeCount }}@else{{$queueDefaults['nodeCount']}}@endif"
                required
-        @if(isset($expVal) ) @if(!$expVal['editable']){{"disabled"}} @endif @endif>
+        @if(isset($expVal) ) @if(!$expVal['editable']) disabled @endif @endif>
     </div>
     <div class="form-group">
         <label for="cpu-count">Total Core Count <span>( Max Allowed Cores - <span
@@ -34,7 +34,7 @@
         <input type="number" class="form-control" name="cpu-count" id="cpu-count" min="1"
                value="@if(isset($expVal) ){{ $expVal['scheduling']->totalCPUCount }}@else{{$queueDefaults['cpuCount']}}@endif"
                required
-        @if(isset($expVal)) @if(!$expVal['editable']){{"disabled"}} @endif @endif>
+        @if(isset($expVal)) @if(!$expVal['editable']) disabled @endif @endif>
     </div>
     <div class="form-group">
         <label for="wall-time">Wall Time Limit <span>( Max Allowed Wall Time - <span
@@ -44,7 +44,7 @@
             <input type="number" class="form-control" name="wall-time" id="wall-time" min="1"
                    value="@if(isset($expVal)){{$expVal['scheduling']->wallTimeLimit}}@else{{$queueDefaults['wallTimeLimit']}}@endif"
                    required
-            @if(isset($expVal)) @if(!$expVal['editable']){{"disabled"}} @endif @endif>
+            @if(isset($expVal)) @if(!$expVal['editable']) disabled @endif @endif>
             <span class="input-group-addon">minutes</span>
         </div>
     </div>
@@ -55,7 +55,7 @@
         <div class="input-group">
             <input type="number" class="form-control" name="total-physical-memory" id="memory-count" min="0"
                    value="@if(isset($expVal) ){{ $expVal['scheduling']->totalPhysicalMemory }}@endif"
-            @if(isset($expVal)) @if(!$expVal['editable']){{"disabled"}} @endif @endif>
+            @if(isset($expVal)) @if(!$expVal['editable']) disabled @endif @endif>
             <span class="input-group-addon">MB</span>
         </div>
     </div>
@@ -64,7 +64,7 @@
                         {{--class="static-working-dir alert-warning"></span></label>--}}
         {{--<input type="text" class="form-control" name="static-working-dir" id="static-working-dir"--}}
                {{--value="@if(isset($expVal) ){{ $expVal['scheduling']->staticWorkingDir }}@endif"--}}
-        {{--@if(isset($expVal)) @if(!$expVal['editable']){{"disabled"}} @endif @endif>--}}
+        {{--@if(isset($expVal)) @if(!$expVal['editable']) disabled @endif @endif>--}}
     {{--</div>--}}
 </div>
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f5092180/app/views/project/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/summary.blade.php b/app/views/project/summary.blade.php
index bb1a352..dd7a0b3 100755
--- a/app/views/project/summary.blade.php
+++ b/app/views/project/summary.blade.php
@@ -41,7 +41,7 @@
                 <?php 
 
                 foreach ($experiments as $experiment) {
-                    $expValues = ExperimentUtilities::get_experiment_values($experiment, $project, true);
+                    $expValues = ExperimentUtilities::get_experiment_values($experiment, true);
                     $expValues["jobState"] = ExperimentUtilities::get_job_status($experiment);
                     $applicationInterface = AppUtilities::get_application_interface($experiment->executionId);