aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Fixed duration calculation in the job page.
Date Tue, 13 May 2014 22:04:36 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 653d581e2 -> f837a7dfe


Fixed duration calculation in the job page.

Testing Done:
Tested locally on laptop. Attached screenshot.

Bugs closed: AURORA-411

Reviewed at https://reviews.apache.org/r/21354/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/f837a7df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/f837a7df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/f837a7df

Branch: refs/heads/master
Commit: f837a7dfe7d52e2826261a05eadbbce2a49cde89
Parents: 653d581
Author: Suman Karumuri <mansu@apache.org>
Authored: Tue May 13 15:01:12 2014 -0700
Committer: Suman Karumuri <skarumuri@twitter.com>
Committed: Tue May 13 15:01:12 2014 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/http/ui/js/controllers.js    | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/f837a7df/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
index 768c4fe..4a83e1d 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
@@ -426,7 +426,7 @@ auroraUIControllers.controller('JobController',
         statusMessage: latestTaskEvent.message,
         host: task.assignedTask.slaveHost || '',
         latestActivity: _.isEmpty(sortedTaskEvents) ? 0 : latestTaskEvent.timestamp,
-        duration: getDuration(sortedTaskEvents, isActive),
+        duration: getDuration(sortedTaskEvents),
         isActive: isActive,
         taskId: task.assignedTask.taskId,
         taskEvents: summarizeTaskEvents(sortedTaskEvents),
@@ -435,16 +435,20 @@ auroraUIControllers.controller('JobController',
       };
     }
 
-    function getDuration(sortedTaskEvents, isActive) {
-      if (!isActive || _.isEmpty(sortedTaskEvents)) {
-        return 0;
-      }
-
+    function getDuration(sortedTaskEvents) {
       var runningTaskEvent = _.find(sortedTaskEvents, function (taskEvent) {
         return taskEvent.status === ScheduleStatus.RUNNING;
       });
 
-      return runningTaskEvent ? _.last(sortedTaskEvents).timestamp - runningTaskEvent.timestamp
: 0;
+      if (runningTaskEvent) {
+        var nextEvent = sortedTaskEvents[_.indexOf(sortedTaskEvents, runningTaskEvent) +
1];
+
+        return nextEvent
+          ? nextEvent.timestamp - runningTaskEvent.timestamp
+          : moment().valueOf() - runningTaskEvent.timestamp;
+      }
+
+      return 0;
     }
 
     function summarizeTaskEvents(taskEvents) {


Mime
View raw message