airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [1/2] airavata-php-gateway git commit: AIRAVATA-1887 Ordering tasks by taskDag
Date Fri, 06 Jan 2017 15:19:30 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop a5f317f02 -> 84c359279


AIRAVATA-1887 Ordering tasks by taskDag


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

Branch: refs/heads/develop
Commit: a7249ed3d6911cfd28efefd8e7c3a52291d7c37f
Parents: a5f317f
Author: Marcus Christie <machristie@apache.org>
Authored: Thu Jan 5 13:16:42 2017 -0500
Committer: Marcus Christie <machristie@apache.org>
Committed: Fri Jan 6 10:18:44 2017 -0500

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a7249ed3/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 90193ae..cdbb6c8 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -234,7 +234,19 @@ class ExperimentUtilities
     {
 
         try {
-            return Airavata::getDetailedExperimentTree(Session::get('authz-token'), $expId);
+            $detailed_experiment = Airavata::getDetailedExperimentTree(Session::get('authz-token'),
$expId);
+            Log::debug("detailed exp", array($detailed_experiment));
+            foreach ($detailed_experiment->processes as $index => $process) {
+                usort($process->tasks, ExperimentUtilities::sortTasksByTaskDagOrder($process->taskDag));
+                Log::debug("process", array($process, $process->taskDag));
+                Log::debug("task list", array($process, $process->tasks));
+                foreach ($process->tasks as $task) {
+                    Log::debug("task", array("taskId" => $task->taskId,
+                    "creationTime" => $task->creationTime, "lastUpdateTime" => $task->lastUpdateTime,
"status" => $task->taskStatuses));
+                    // TODO: sort taskStatuses by time and output them
+                }
+            }
+            return $detailed_experiment;
         } catch (InvalidRequestException $ire) {
             CommonUtilities::print_error_message('<p>There was a problem getting the
experiment.
             Please try again later or submit a bug report using the link in the Help menu.</p>'
.
@@ -263,6 +275,18 @@ class ExperimentUtilities
 
     }
 
+    private static function sortTasksByTaskDagOrder($taskDag)
+    {
+        $taskDagArray = preg_split("/,/", $taskDag);
+        Log::debug("taskDagArray", array($taskDagArray));
+        return function($task1, $task2) use ($taskDagArray) {
+            $taskOrder1 = array_search($task1->taskId, $taskDagArray);
+            $taskOrder2 = array_search($task2->taskId, $taskDagArray);
+            Log::debug("tasks and order", array($task1->taskId, $taskOrder1, $task2->taskId,
$taskOrder2));
+            return $taskOrder1 - $taskOrder2;
+        };
+    }
+
     /**
      * Create and configure a new Experiment
      * @return Experiment


Mime
View raw message