You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2017/07/18 04:09:24 UTC

mesos git commit: Updated agent webui page to display a reservation table.

Repository: mesos
Updated Branches:
  refs/heads/master 53fc25dd0 -> ae055b33c


Updated agent webui page to display a reservation table.

This displays how many resources are reserved to which roles
(as well as displaying an entry for unreserved resources), as
well as how much of each reservation is allocated. It does not
show the roles that the resources are allocated to, which may
be different than the reservation role. In the case of
unreserved resources, the allocation role can be any role.

Review: https://reviews.apache.org/r/60370/


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

Branch: refs/heads/master
Commit: ae055b33c04d7f802fe5be4775cc13d2b5b5b970
Parents: 53fc25d
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Mon Jul 17 20:58:30 2017 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Jul 17 21:08:14 2017 -0700

----------------------------------------------------------------------
 src/webui/master/static/agent.html        | 29 ++++++++++++++++++++++++++
 src/webui/master/static/js/controllers.js |  8 +++++++
 2 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ae055b33/src/webui/master/static/agent.html
----------------------------------------------------------------------
diff --git a/src/webui/master/static/agent.html b/src/webui/master/static/agent.html
index 71e5e70..908d01d 100644
--- a/src/webui/master/static/agent.html
+++ b/src/webui/master/static/agent.html
@@ -160,6 +160,35 @@
 
   </div>
   <div class="col-md-9">
+    <table m-table table-content="agent.reserved_resources_as_array" title="Resource Reservations"
+      class="table table-striped table-bordered table-condensed">
+      <thead>
+        <tr>
+          <th data-key="role">Reservation Role</th>
+          <th data-key="cpus">CPUs (Allocated / Total)</th>
+          <th data-key="gpus">GPUs (Allocated / Total)</th>
+          <th data-key="mem">Mem (Allocated / Total)</th>
+          <th data-key="disk">Disk (Allocated / Total)</th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr>
+          <td><em>Unreserved</em></td>
+          <td>{{state.unreserved_resources_allocated.cpus | number}} / {{state.unreserved_resources.cpus | number}}</td>
+          <td>{{state.unreserved_resources_allocated.gpus | number}} / {{state.unreserved_resources.gpus | number}}</td>
+          <td>{{state.unreserved_resources_allocated.mem * (1024 * 1024) | dataSize}} / {{state.unreserved_resources.mem * (1024 * 1024) | dataSize}}</td>
+          <td>{{state.unreserved_resources_allocated.disk * (1024 * 1024) | dataSize}} / {{state.unreserved_resources.disk * (1024 * 1024) | dataSize}}</td>
+        </tr>
+        <tr ng-repeat="reservation in $data">
+          <td>{{reservation.role}}</td>
+          <td>{{(state.reserved_resources_allocated[reservation.role].cpus || 0) | number}} / {{reservation.cpus | number}}</td>
+          <td>{{(state.reserved_resources_allocated[reservation.role].gpus || 0) | number}} / {{reservation.gpus | number}}</td>
+          <td>{{(state.reserved_resources_allocated[reservation.role].mem * (1024 * 1024) || 0) | dataSize}} / {{reservation.mem * (1024 * 1024) | dataSize}}</td>
+          <td>{{(state.reserved_resources_allocated[reservation.role].disk * (1024 * 1024) || 0) | dataSize}} / {{reservation.disk * (1024 * 1024) | dataSize}}</td>
+        </tr>
+      </tbody>
+    </table>
+
     <table m-table table-content="agent.frameworks" title="Frameworks"
       class="table table-striped table-bordered table-condensed">
       <thead>

http://git-wip-us.apache.org/repos/asf/mesos/blob/ae055b33/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 67bfd03..2745614 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -601,6 +601,14 @@
           $scope.agent.frameworks = {};
           $scope.agent.completed_frameworks = {};
 
+          // Convert the reserved resources map into an array for inclusion
+          // in an `ng-repeat` table.
+          $scope.agent.reserved_resources_as_array = _($scope.state.reserved_resources)
+            .map(function(reservation, role) {
+              reservation.role = role;
+              return reservation;
+            });
+
           // Computes framework stats by setting new attributes on the 'framework'
           // object.
           function computeFrameworkStats(framework) {