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/09/21 23:21:43 UTC

mesos git commit: Display task state counters in the framework page.

Repository: mesos
Updated Branches:
  refs/heads/master 3e25168c3 -> 548aaee3a


Display task state counters in the framework page.

Fixes MESOS-7962.

This closes #234


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

Branch: refs/heads/master
Commit: 548aaee3a8f5935457767db1e3b761d873b09cbf
Parents: 3e25168
Author: Tomasz Janiszewski <to...@allegrogroup.com>
Authored: Thu Sep 21 16:16:06 2017 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Sep 21 16:21:36 2017 -0700

----------------------------------------------------------------------
 src/webui/master/static/framework.html    | 42 ++++++++++++++++++++++++++
 src/webui/master/static/js/controllers.js | 30 ++++++++++++++++++
 2 files changed, 72 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/548aaee3/src/webui/master/static/framework.html
----------------------------------------------------------------------
diff --git a/src/webui/master/static/framework.html b/src/webui/master/static/framework.html
index 0752813..4912b7f 100644
--- a/src/webui/master/static/framework.html
+++ b/src/webui/master/static/framework.html
@@ -45,6 +45,48 @@
         <dd>{{framework.tasks.length | number}}</dd>
       </dl>
 
+      <h4>Tasks</h4>
+      <table class="table table-condensed">
+        <tbody>
+          <tr>
+            <td>Staging</td>
+            <td class="text-right">{{framework.staging_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Starting</td>
+            <td class="text-right">{{framework.starting_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Running</td>
+            <td class="text-right">{{framework.running_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Unreachable</td>
+            <td class="text-right">{{framework.unreachable_tasks.length | number}}</td>
+          </tr>
+          <tr>
+            <td>Killing</td>
+            <td class="text-right">{{framework.killing_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Finished</td>
+            <td class="text-right">{{framework.finished_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Killed</td>
+            <td class="text-right">{{framework.killed_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Failed</td>
+            <td class="text-right">{{framework.failed_tasks | number}}</td>
+          </tr>
+          <tr>
+            <td>Lost</td>
+            <td class="text-right">{{framework.lost_tasks | number}}</td>
+          </tr>
+        </tbody>
+      </table>
+
       <h4>Resources</h4>
       <table class="table table-condensed">
         <thead>

http://git-wip-us.apache.org/repos/asf/mesos/blob/548aaee3/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 0a0833f..e2cb2d8 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -246,6 +246,36 @@
       _.each(framework.unreachable_tasks, setTaskMetadata);
       _.each(framework.completed_tasks, setTaskMetadata);
 
+      // TODO(bmahler): Add per-framework metrics to the master so that
+      // the webui does not need to loop over all tasks!
+      framework.running_tasks = 0;
+      framework.staging_tasks = 0;
+      framework.starting_tasks = 0;
+      framework.killing_tasks = 0;
+
+      _.each(framework.tasks, function(task) {
+        switch (task.state) {
+            case "TASK_STAGING": framework.staging_tasks++; break;
+            case "TASK_STARTING": framework.starting_tasks++; break;
+            case "TASK_RUNNING": framework.running_tasks++; break;
+            case "TASK_KILLING": framework.killing_tasks++; break;
+        }
+      })
+
+      framework.finished_tasks = 0;
+      framework.killed_tasks = 0;
+      framework.failed_tasks = 0;
+      framework.lost_tasks = 0;
+
+      _.each(framework.completed_tasks, function(task) {
+        switch (task.state) {
+            case "TASK_FINISHED": framework.finished_tasks++; break;
+            case "TASK_KILLED": framework.killed_tasks++; break;
+            case "TASK_FAILED": framework.failed_tasks++; break;
+            case "TASK_LOST": framework.lost_tasks++; break;
+        }
+      })
+
       $scope.active_tasks = $scope.active_tasks.concat(framework.tasks);
       $scope.unreachable_tasks = $scope.unreachable_tasks.concat(framework.unreachable_tasks);
       $scope.completed_tasks =