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/03/25 21:49:23 UTC

[38/40] airavata-php-gateway git commit: fixing showing experiment output values in PGA

fixing showing experiment output values in PGA


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

Branch: refs/heads/master
Commit: a03f217a6950a454e7c68cffe9f0e9992051a216
Parents: 2805fd7
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 25 15:56:54 2016 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 25 15:56:54 2016 -0400

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 40 ++++++++++++------------------
 1 file changed, 16 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a03f217a/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 011e6ed..a687e51 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -670,42 +670,34 @@ class ExperimentUtilities
     {
         if( $process)
         {
-            $processStatusVal = array_search($status, ProcessState::$__names);
             if ($status != ProcessState::COMPLETED)
                 echo "Process hasn't completed. Process Status is : " . ProcessState::$__names[ $status] . '<br/>';
         }
         else
         {
-            $expStatusVal = array_search($status, ExperimentState::$__names);
             if ( $status != ExperimentState::COMPLETED)
                 echo "Experiment hasn't completed. Experiment Status is : " .  ExperimentState::$__names[ $status] . '<br/>';
         }
-        //$outputs = $experiment->experimentOutputs;
-        //print_r( $outputs); exit;
+
         foreach ((array)$outputs as $output) {
             if ($output->type == DataType::URI || $output->type == DataType::STDOUT || $output->type == DataType::STDERR) {
-                if(file_exists(str_replace('//','/',$output->value))){
-                    $outputPathArray = explode("/", $output->value);
-
-                    echo '<p>' . $output->name . ' : ' . '<a target="_blank"
-                            href="' . URL::to("/") . '/download?path=' .
-                                                $outputPathArray[ count($outputPathArray)-4] . "/" . 
-                                                $outputPathArray[ count($outputPathArray)-3] . "/" . 
-                                                $outputPathArray[ count($outputPathArray)-2] . '/' . 
-                                                $outputPathArray[ count($outputPathArray)-1] . '">' .
-                                                    $outputPathArray[sizeof($outputPathArray) - 1] . 
-                        ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+                $dataProductModel = Airavata::getDataProduct(Session::get('authz-token'), $output->value);
+                $currentInputPath = "";
+                foreach ($dataProductModel->replicaLocations as $rp) {
+                    if ($rp->replicaLocationCategory == ReplicaLocationCategory::GATEWAY_DATA_STORE) {
+                        $currentInputPath = $rp->filePath;
+                        break;
+                    }
                 }
-//                else
-//                    echo 'Output paths are not correctly defined for : <br/>' . $output->name . '<br/><br/> Please report this issue to the admin<br/><br/>';
-            
-            } 
-            elseif ($output->type == DataType::STRING) {
+                $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
+                if (!ExperimentUtilities::endsWith($dataRoot, "/"))
+                    $dataRoot = $dataRoot . "/";
+                $filePath = str_replace($dataRoot, "", $currentInputPath);
+                echo '<p><a target="_blank" href="' . URL::to("/") . '/download/?path=' . $filePath . '">' . basename($filePath) . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+            } elseif ($output->type == DataType::STRING) {
                 echo '<p>' . $output->value . '</p>';
-            }
-            else
-                echo 'output : '. $output;
-            //echo 'output-type : ' . $output->type;
+            } else
+                echo 'output : ' . $output;
         }
     }