You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ss...@apache.org on 2013/07/26 19:52:08 UTC

[1/2] git commit: Iterate over all offers only once

Updated Branches:
  refs/heads/master 649f89948 -> 7d108f767


Iterate over all offers only once

Offers are first appended to "$scope.offers" while iterating over each
framework, and then "$scope.offers" is iterated to calculate stats. The
stats can instead be calculated at the same time the offers are
appended to "$scope.offers" to save an iteration.

Review: http://reviews.apache.org/r/12832


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

Branch: refs/heads/master
Commit: fbf633961fa5fc7aef4c5b9e38647b23b4811a8d
Parents: 649f899
Author: Ross Allen <re...@gmail.com>
Authored: Fri Jul 19 17:54:03 2013 -0700
Committer: Ross Allen <re...@gmail.com>
Committed: Fri Jul 26 10:51:23 2013 -0700

----------------------------------------------------------------------
 src/webui/master/static/js/controllers.js | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fbf63396/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js b/src/webui/master/static/js/controllers.js
index 7f89a41..d47f29b 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -194,6 +194,10 @@
 
       _.each(framework.offers, function(offer) {
         $scope.offers[offer.id] = offer;
+        $scope.offered_cpus += offer.resources.cpus;
+        $scope.offered_mem += offer.resources.mem;
+        offer.framework_name = $scope.frameworks[offer.framework_id].name;
+        offer.hostname = $scope.slaves[offer.slave_id].hostname;
       });
 
       $scope.used_cpus += framework.resources.cpus;
@@ -233,13 +237,6 @@
       $scope.completed_frameworks[framework.id] = framework;
     });
 
-    _.each($scope.offers, function(offer) {
-      $scope.offered_cpus += offer.resources.cpus;
-      $scope.offered_mem += offer.resources.mem;
-      offer.framework_name = $scope.frameworks[offer.framework_id].name;
-      offer.hostname = $scope.slaves[offer.slave_id].hostname;
-    });
-
     $scope.used_cpus -= $scope.offered_cpus;
     $scope.used_mem -= $scope.offered_mem;
 


[2/2] git commit: Removed unneeded mapping of ID -> executor

Posted by ss...@apache.org.
Removed unneeded mapping of ID -> executor

`framework.executors` and `framework.completed_executors` were arrays
that were converted into maps of ID -> executor, and then the template
called `_.values` to use just the values, i.e. the original executor
arrays, to sort the table.

Stick with the original arrays and save lots of allocation.

Review: http://reviews.apache.org/r/12833


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7d108f76
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7d108f76
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7d108f76

Branch: refs/heads/master
Commit: 7d108f7675cb831b4a27bcd85c4a823efc96923a
Parents: fbf6339
Author: Ross Allen <re...@gmail.com>
Authored: Sat Jul 20 01:57:44 2013 -0700
Committer: Ross Allen <re...@gmail.com>
Committed: Fri Jul 26 10:51:58 2013 -0700

----------------------------------------------------------------------
 src/webui/master/static/js/controllers.js    | 6 ------
 src/webui/master/static/slave_framework.html | 4 ++--
 2 files changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7d108f76/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js b/src/webui/master/static/js/controllers.js
index d47f29b..84012de 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -587,12 +587,6 @@
           return;
         }
 
-        // Construct maps of the executors.
-        $scope.framework.executors = _.object(
-            _.pluck($scope.framework.executors, 'id'), $scope.framework.executors);
-        $scope.framework.completed_executors = _.object(
-            _.pluck($scope.framework.completed_executors, 'id'), $scope.framework.completed_executors);
-
         // Compute the framework stats.
         $scope.framework.num_tasks = 0;
         $scope.framework.cpus = 0;

http://git-wip-us.apache.org/repos/asf/mesos/blob/7d108f76/src/webui/master/static/slave_framework.html
----------------------------------------------------------------------
diff --git a/src/webui/master/static/slave_framework.html b/src/webui/master/static/slave_framework.html
index 0df5c04..63eb5c4 100644
--- a/src/webui/master/static/slave_framework.html
+++ b/src/webui/master/static/slave_framework.html
@@ -108,7 +108,7 @@
       </thead>
 
       <tbody>
-        <tr ng-repeat="executor in _.values(framework.executors) | orderBy:tables['executors'].selected_column:tables['executors'].reverse">
+        <tr ng-repeat="executor in framework.executors | orderBy:tables['executors'].selected_column:tables['executors'].reverse">
           <td>
             <a href="{{'#/slaves/' + slave_id + '/frameworks/' + framework.id + '/executors/' + executor.id}}">
               {{executor.id}}
@@ -156,7 +156,7 @@
       </thead>
 
       <tbody>
-        <tr ng-repeat="completed_executor in _.values(framework.completed_executors) | orderBy:tables['completed_executors'].selected_column:tables['completed_executors'].reverse">
+        <tr ng-repeat="completed_executor in framework.completed_executors | orderBy:tables['completed_executors'].selected_column:tables['completed_executors'].reverse">
           <td>
             <a href="{{'#/slaves/' + slave_id + '/frameworks/' + framework.id + '/executors/' + completed_executor.id}}">
               {{completed_executor.id}}