aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject git commit: Use tasksWithoutConfig on job page to reduce page load time for jobs with large amount of active instances.
Date Fri, 01 Aug 2014 18:43:51 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 475fdd3a4 -> 98561eaf5


Use tasksWithoutConfig on job page to reduce page load time for jobs with
large amount of active instances.

Bugs closed: AURORA-551

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


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

Branch: refs/heads/master
Commit: 98561eaf59dd4d9df3da678402eb596bb0fa23b3
Parents: 475fdd3
Author: David McLaughlin <david@dmclaughlin.com>
Authored: Fri Aug 1 11:40:44 2014 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Fri Aug 1 11:40:44 2014 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/http/ui/groupSummary.html  |  2 +-
 .../aurora/scheduler/http/ui/js/controllers.js  | 27 +++++++++-------
 .../aurora/scheduler/http/ui/js/services.js     | 33 +++++++++++++++++++-
 3 files changed, 49 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/98561eaf/src/main/resources/org/apache/aurora/scheduler/http/ui/groupSummary.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/groupSummary.html b/src/main/resources/org/apache/aurora/scheduler/http/ui/groupSummary.html
index b3480ac..29ef74a 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/groupSummary.html
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/groupSummary.html
@@ -28,7 +28,7 @@
     </li>
   </ul>
   <a ng-click="showAllGroups()" ng-if="visibleGroups.length < groups.length">
-    show <span ng-if="groups.length > 1">all</span><span ng-if="groups.length
=== 1">config</span>
+    show <span ng-if="groups.length > 1">all configs</span><span ng-if="groups.length
=== 1">config</span>
   </a>
   <span ng-if="visibleGroups.length < groups.length && visibleGroups.length
> 0"> | </span>
   <a ng-if="visibleGroups.length > 0" ng-click="hideAllGroups()">

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/98561eaf/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 fc8b40b..3477b7e 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
@@ -294,6 +294,12 @@
       $scope.activeTasks = getTasksForJob($scope.role, $scope.environment, $scope.job);
 
       function buildGroupSummary($scope) {
+        var response = auroraClient.getConfigSummary($scope.role, $scope.environment, $scope.job);
+        if (response.error) {
+          $scope.error = 'Error fetching configuration summary: ' + response.error;
+          return [];
+        }
+
         var colors = [
           'steelblue',
           'darkseagreen',
@@ -302,30 +308,30 @@
           'khaki'
         ];
 
-        var total = _.reduce($scope.taskSummary, function (m, n) {
-          return m + ((n.range.end - n.range.start) + 1);
+        var total = _.reduce(response.groups, function (m, n) {
+          return m + n.instanceIds.length;
         }, 0);
 
-        $scope.groupSummary = $scope.taskSummary.map(function (summary, i) {
-          var count = (summary.range.end - summary.range.start) + 1;
+        $scope.groupSummary = response.groups.map(function (group, i) {
+          var count = group.instanceIds.length;
           var percentage = (count / total) * 100;
 
-          var label = (summary.range.start === summary.range.end) ?
-            summary.range.start :
-            summary.range.start + '-' + summary.range.end;
+          var ranges = taskUtil.toRanges(group.instanceIds).map(function (r) {
+            return (r.start === r.end) ? r.start : r.start + '-' + r.end;
+          });
 
           return {
-            label: label,
+            label: ranges.join(', '),
             value: count,
             percentage: percentage,
-            summary: summary,
+            summary: { schedulingDetail: taskUtil.configToDetails(group.config)},
             color: colors[i % colors.length]
           };
         });
       }
 
       function getTasksForJob(role, environment, job) {
-        var response = auroraClient.getTasks(role, environment, job);
+        var response = auroraClient.getTasksWithoutConfigs(role, environment, job);
 
         if (response.error) {
           $scope.error = 'Error fetching tasks: ' + response.error;
@@ -334,7 +340,6 @@
 
         $scope.jobDashboardUrl = getJobDashboardUrl(response.statsUrlPrefix);
 
-        $scope.taskSummary = taskUtil.summarizeActiveTaskConfigs(response.tasks);
         buildGroupSummary($scope);
 
         var tasks = _.map(response.tasks, function (task) {

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/98561eaf/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
index 8aef242..bfd360d 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
@@ -13,9 +13,19 @@
  */
 (function () {
   /* global auroraUI:false, Identity:false, TaskQuery:false, ReadOnlySchedulerClient:false,
-            ACTIVE_STATES:false, CronCollisionPolicy: false */
+            ACTIVE_STATES:false, CronCollisionPolicy: false, JobKey: false */
   'use strict';
 
+  function makeJobTaskQuery(role, environment, jobName) {
+    var id = new Identity();
+    id.role = role;
+    var taskQuery = new TaskQuery();
+    taskQuery.owner = id;
+    taskQuery.environment = environment;
+    taskQuery.jobName = jobName;
+    return taskQuery;
+  }
+
   auroraUI.factory(
     'auroraClient',
     ['$window',
@@ -59,6 +69,27 @@
             return result;
           },
 
+          getTasksWithoutConfigs: function (role, environment, jobName) {
+            var query = makeJobTaskQuery(role, environment, jobName);
+            var response = auroraClient.getSchedulerClient().getTasksWithoutConfigs(query);
+            var result = auroraClient.processResponse(response);
+            result.tasks = response.result !== null ?
+              response.result.scheduleStatusResult.tasks : [];
+            return result;
+          },
+
+          getConfigSummary: function (role, environment, jobName) {
+            var key = new JobKey();
+            key.role = role;
+            key.environment = environment;
+            key.name = jobName;
+            var response = auroraClient.getSchedulerClient().getConfigSummary(key);
+            var result = auroraClient.processResponse(response);
+            result.groups = response.result !== null ?
+              response.result.configSummaryResult.summary.groups : [];
+            return result;
+          },
+
           // Utility functions
           // TODO(Suman Karumuri): Make schedulerClient a service
           schedulerClient: null,


Mime
View raw message