Repository: mesos Updated Branches: refs/heads/master 90458f1e6 -> 5d4328b92
Display task health in the Web UI. Fixes: MESOS-7961. This closes #233 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5d4328b9 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5d4328b9 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5d4328b9 Branch: refs/heads/master Commit: 5d4328b9204f4ae7a2b48e2cbc656be54afe6198 Parents: 90458f1 Author: Tomasz Janiszewski <tomasz.janiszew...@allegrogroup.com> Authored: Mon Oct 2 13:10:45 2017 -0700 Committer: Benjamin Mahler <bmah...@apache.org> Committed: Mon Oct 2 13:37:43 2017 -0700 ---------------------------------------------------------------------- src/webui/master/static/agent_executor.html | 2 ++ src/webui/master/static/css/mesos.css | 10 ++++++++++ src/webui/master/static/framework.html | 2 ++ src/webui/master/static/home.html | 4 +++- src/webui/master/static/js/app.js | 12 ++++++++++++ src/webui/master/static/js/controllers.js | 11 +++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4328b9/src/webui/master/static/agent_executor.html ---------------------------------------------------------------------- diff --git a/src/webui/master/static/agent_executor.html b/src/webui/master/static/agent_executor.html index d9427c1..7ec56c3 100644 --- a/src/webui/master/static/agent_executor.html +++ b/src/webui/master/static/agent_executor.html @@ -136,6 +136,7 @@ <th data-key="name">Name</th> <th data-key="role">Role</th> <th data-key="state">State</th> + <th data-key="healthy">Health</th> <th data-key="resources.cpus">CPUs (allocated)</th> <th data-key="resources.gpus">GPUs (allocated)</th> <th data-key="resources.mem">Mem (allocated)</th> @@ -149,6 +150,7 @@ <td>{{task.name}}</td> <td>{{task.role}}</td> <td>{{task.state}}</td> + <td class="task-{{task.healthy | taskHealth}}">{{task.healthy | taskHealth}}</td> <td>{{task.resources.cpus | number}}</td> <td>{{task.resources.gpus | number}}</td> <td>{{task.resources.mem * (1024 * 1024) | dataSize}}</td> http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4328b9/src/webui/master/static/css/mesos.css ---------------------------------------------------------------------- diff --git a/src/webui/master/static/css/mesos.css b/src/webui/master/static/css/mesos.css index e807466..3e3a3b1 100644 --- a/src/webui/master/static/css/mesos.css +++ b/src/webui/master/static/css/mesos.css @@ -185,3 +185,13 @@ a.badge-type:hover { .hidden-text { font-size: 0; } + +.task-healthy { + color: #27c97b; + text-transform: capitalize; +} + +.task-unhealthy { + color: #f33745; + text-transform: capitalize; +} http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4328b9/src/webui/master/static/framework.html ---------------------------------------------------------------------- diff --git a/src/webui/master/static/framework.html b/src/webui/master/static/framework.html index 4912b7f..82f6b27 100644 --- a/src/webui/master/static/framework.html +++ b/src/webui/master/static/framework.html @@ -147,6 +147,7 @@ <th data-key="name">Name</th> <th data-key="role">Role</th> <th data-key="state">State</th> + <th data-key="healthy">Health</th> <th data-key="start_time">Started</th> <th data-key="host">Host</th> <th></th> @@ -162,6 +163,7 @@ <td>{{task.name}}</td> <td>{{task.role}}</td> <td>{{task.state | truncateMesosState}}</td> + <td class="task-{{task.healthy | taskHealth}}">{{task.healthy | taskHealth}}</td> <td> <m-timestamp value="{{task.start_time}}"></m-timestamp> </td> http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4328b9/src/webui/master/static/home.html ---------------------------------------------------------------------- diff --git a/src/webui/master/static/home.html b/src/webui/master/static/home.html index a4aaa4f..df3eef6 100644 --- a/src/webui/master/static/home.html +++ b/src/webui/master/static/home.html @@ -162,6 +162,7 @@ <th data-key="name">Task Name</th> <th data-key="role">Role</th> <th data-key="state">State</th> + <th data-key="healthy">Health</th> <th data-key="start_time" data-sort>Started</th> <th data-key="host">Host</th> <th></th> @@ -169,7 +170,7 @@ </thead> <tbody> <tr data-ng-if="active_tasks.length === 0"> - <td colspan="7">No active tasks.</td> + <td colspan="8">No active tasks.</td> </tr> <tr ng-repeat="task in $data"> <td> @@ -192,6 +193,7 @@ <td>{{task.name}}</td> <td>{{task.role}}</td> <td>{{task.state | truncateMesosState}}</td> + <td class="task-{{task.healthy | taskHealth}}">{{task.healthy | taskHealth}}</td> <td> <m-timestamp value="{{task.start_time}}"></m-timestamp> </td> http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4328b9/src/webui/master/static/js/app.js ---------------------------------------------------------------------- diff --git a/src/webui/master/static/js/app.js b/src/webui/master/static/js/app.js index e51c6d6..39f66d2 100644 --- a/src/webui/master/static/js/app.js +++ b/src/webui/master/static/js/app.js @@ -109,6 +109,18 @@ return state.substring(5); }; }) + .filter('taskHealth', function() { + return function(healthy) { + if (healthy == null) { + return "-"; + } + + // Note that this string value is relied on to match + // against CSS classes to color the UI. Changing this + // also requires an update to the CSS. + return healthy ? "healthy" : "unhealthy"; + } + }) .filter('isoDate', function($filter) { return function(date) { var i = parseInt(date, 10); http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4328b9/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 e2cb2d8..d4904f8 100644 --- a/src/webui/master/static/js/controllers.js +++ b/src/webui/master/static/js/controllers.js @@ -172,6 +172,7 @@ if (isStateTerminal(task.state)) { task.finish_time = lastStatus.timestamp * 1000; } + task.healthy = lastStatus.healthy; } }; @@ -884,6 +885,15 @@ }); } + function setHealth(tasks) { + _.each(tasks, function(task) { + var lastStatus = _.last(task.statuses); + if (lastStatus) { + task.healthy = lastStatus.healthy; + } + }) + }; + // Look for the executor; it's either active or completed. $scope.executor = _.find($scope.framework.executors, matchExecutor) || @@ -906,6 +916,7 @@ setRole($scope.executor.completed_tasks); } + setHealth($scope.executor.tasks); setTaskSandbox($scope.executor); $('#agent').show();