airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata-php-gateway git commit: making experiment search in PGA compatible with airavata master
Date Sun, 02 Aug 2015 19:18:06 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/master aa606b298 -> f52056f73


making experiment search in PGA compatible with airavata master


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

Branch: refs/heads/master
Commit: f52056f7325df83b63acdf48526cef01ee59e6d9
Parents: aa606b2
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Mon Aug 3 00:47:42 2015 +0530
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Mon Aug 3 00:47:42 2015 +0530

----------------------------------------------------------------------
 app/libraries/AdminUtilities.php                |  2 +-
 app/libraries/AppUtilities.php                  |  3 +-
 app/libraries/ExperimentUtilities.php           | 76 +++++++++++++++++---
 .../partials/experiment-container.blade.php     |  4 +-
 4 files changed, 69 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f52056f7/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index 73f5d5d..be83d1f 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -61,7 +61,7 @@ class AdminUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectID),
true);
+            $expValue = ExperimentUtilities::get_experiment_summary_values($experiment, ProjectUtilities::get_project($experiment->projectID),
true);
             $expContainer[$expNum]['experiment'] = $experiment;
             $expValue["editable"] = false;
             $expContainer[$expNum]['expValue'] = $expValue;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f52056f7/app/libraries/AppUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php
index faa155f..ea9926f 100644
--- a/app/libraries/AppUtilities.php
+++ b/app/libraries/AppUtilities.php
@@ -38,13 +38,12 @@ class AppUtilities
     public static function getAppInterfaceData()
     {
 
-        $dataType = new DataType();
         $modules = AppUtilities::getAllModules();
         $appInterfaces = Airavata::getAllApplicationInterfaces(Session::get('authz-token'),
Session::get("gateway_id"));
 
         return array(
             "appInterfaces" => $appInterfaces,
-            "dataTypes" => $dataType::$__names,
+            "dataTypes" => \Airavata\Model\Application\Io\DataType::$__names,
             "modules" => $modules
         );
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f52056f7/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 5a216d6..9419c1f 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -617,9 +617,63 @@ class ExperimentUtilities
             echo "Experiment hasn't completed. Experiment Status is : " . $expStatus;
     }
 
+    public static function get_experiment_summary_values($experimentSummary, $project, $forSearch
= false)
+    {
+//        var_dump( $experimentSummary); exit;
+        $expVal = array();
+        $expVal["experimentStatusString"] = "";
+        $expVal["experimentTimeOfStateChange"] = "";
+        $expVal["experimentCreationTime"] = "";
+
+        $expVal["experimentStatusString"] = $experimentSummary->experimentStatus;
+        $expVal["experimentTimeOfStateChange"] = $experimentSummary->statusUpdateTime
/ 1000; // divide by 1000 since timeOfStateChange is in ms
+        $expVal["experimentCreationTime"] = $experimentSummary->creationTime / 1000; //
divide by 1000 since creationTime is in ms
+
+        if (!$forSearch) {
+            $userConfigData = $experimentSummary->userConfigurationData;
+            $scheduling = $userConfigData->computationalResourceScheduling;
+            $expVal['scheduling'] = $scheduling;
+            try {
+                $expVal["computeResource"] = CRUtilities::get_compute_resource($scheduling->resourceHostId);
+            } catch (Exception $ex) {
+                //Error while retrieving CR
+                $expVal["computeResource"] = "";
+            }
+        }
+        $expVal["applicationInterface"] = AppUtilities::get_application_interface($experimentSummary->executionId);
+
+        switch ($experimentSummary->experimentStatus) {
+            case 'CREATED':
+            case 'VALIDATED':
+            case 'SCHEDULED':
+            case 'FAILED':
+                $expVal["editable"] = true;
+                break;
+            default:
+                $expVal["editable"] = false;
+                break;
+        }
+
+        switch ($experimentSummary->experimentStatus) {
+            case 'CREATED':
+            case 'VALIDATED':
+            case 'SCHEDULED':
+            case 'LAUNCHED':
+            case 'EXECUTING':
+                $expVal["cancelable"] = true;
+                break;
+            default:
+                $expVal["cancelable"] = false;
+                break;
+        }
+
+        return $expVal;
+
+    }
+
+
     public static function get_experiment_values($experiment, $project, $forSearch = false)
     {
-        //var_dump( $experiment); exit;
         $expVal = array();
         $expVal["experimentStatusString"] = "";
         $expVal["experimentTimeOfStateChange"] = "";
@@ -648,7 +702,7 @@ class ExperimentUtilities
         $expVal["applicationInterface"] = AppUtilities::get_application_interface($experiment->executionId);
 
 
-        switch ($experimentStatusString) {
+        switch ($experiment->experimentStatus) {
             case 'CREATED':
             case 'VALIDATED':
             case 'SCHEDULED':
@@ -660,7 +714,7 @@ class ExperimentUtilities
                 break;
         }
 
-        switch ($experimentStatusString) {
+        switch ($experiment->experimentStatus) {
             case 'CREATED':
             case 'VALIDATED':
             case 'SCHEDULED':
@@ -737,7 +791,7 @@ class ExperimentUtilities
             $filters = array();
             if(!empty($inputs["status-type"])){
                 if ($inputs["status-type"] != "ALL") {
-                    $filters[ExperimentSearchFields::STATUS] = $inputs["status-type"];
+                    $filters[\Airavata\Model\Experiment\ExperimentSearchFields::STATUS] =
$inputs["status-type"];
                 }
             }
             if(!empty($inputs["search-key"])){
@@ -746,14 +800,14 @@ class ExperimentUtilities
                         $filters[\Airavata\Model\Experiment\ExperimentSearchFields::EXPERIMENT_NAME]
= $inputs["search-value"];
                         break;
                     case 'experiment-description':
-                        $filters[ExperimentSearchFields::EXPERIMENT_DESC] = $inputs["search-value"];
+                        $filters[\Airavata\Model\Experiment\ExperimentSearchFields::EXPERIMENT_DESC]
= $inputs["search-value"];
                         break;
                     case 'application':
-                        $filters[ExperimentSearchFields::APPLICATION_ID] = $inputs["search-value"];
+                        $filters[\Airavata\Model\Experiment\ExperimentSearchFields::APPLICATION_ID]
= $inputs["search-value"];
                         break;
                     case 'creation-time':
-                        $filters[ExperimentSearchFields::FROM_DATE] = strtotime($inputs["from-date"])
* 1000;
-                        $filters[ExperimentSearchFields::TO_DATE] = strtotime($inputs["to-date"])
* 1000;
+                        $filters[\Airavata\Model\Experiment\ExperimentSearchFields::FROM_DATE]
= strtotime($inputs["from-date"]) * 1000;
+                        $filters[\Airavata\Model\Experiment\ExperimentSearchFields::TO_DATE]
= strtotime($inputs["to-date"]) * 1000;
                         break;
                     case '':
                 }
@@ -785,7 +839,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_summary_values($experiment, ProjectUtilities::get_project($experiment->projectId),
true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;
@@ -842,7 +896,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_search_values($experiment, ProjectUtilities::get_project($experiment->projectId),
true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;
@@ -888,7 +942,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_summary_values($experiment, ProjectUtilities::get_project($experiment->projectId),
true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f52056f7/app/views/partials/experiment-container.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-container.blade.php b/app/views/partials/experiment-container.blade.php
index eb5b31d..7a59041 100644
--- a/app/views/partials/experiment-container.blade.php
+++ b/app/views/partials/experiment-container.blade.php
@@ -44,7 +44,7 @@ else
             echo '<tr>';
             $addEditOption = "";
             if ($experiment['expValue']['editable'])
-                $addEditOption = '<a href="' . URL::to('/') . '/experiment/edit?expId='
. $experiment['experiment']->experimentID . '" title="Edit"><span class="glyphicon
glyphicon-pencil"></span></a>';
+                $addEditOption = '<a href="' . URL::to('/') . '/experiment/edit?expId='
. $experiment['experiment']->experimentId . '" title="Edit"><span class="glyphicon
glyphicon-pencil"></span></a>';
 
             echo '<td>' . $experiment['experiment']->name . $addEditOption . '</td>';
 
@@ -76,7 +76,7 @@ else
             ?>
             <td>
                 <a class="<?php echo $textClass; ?>"
-                   href="{{ URL::to('/') }}/experiment/summary?expId=<?php echo $experiment['experiment']->experimentID;
?>">
+                   href="{{ URL::to('/') }}/experiment/summary?expId=<?php echo $experiment['experiment']->experimentId;
?>">
                     <?php echo $experiment['expValue']['experimentStatusString']; ?>
                 </a>
             </td>


Mime
View raw message