Repository: mesos Updated Branches: refs/heads/master cc15db4b1 -> 1e2b2ad1b
Updated WebUI to display role information under tab 'Agents'. Review: https://reviews.apache.org/r/57193/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/abfabb9e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/abfabb9e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/abfabb9e Branch: refs/heads/master Commit: abfabb9e7b4ab9d043a2162ceec5826997a78d68 Parents: cc15db4 Author: Jay Guo <[email protected]> Authored: Thu Mar 2 12:25:26 2017 -0800 Committer: Benjamin Mahler <[email protected]> Committed: Thu Mar 2 13:49:41 2017 -0800 ---------------------------------------------------------------------- src/webui/master/static/agent.html | 12 ++++++++ src/webui/master/static/agent_executor.html | 8 +++++ src/webui/master/static/agent_framework.html | 10 ++++++ src/webui/master/static/js/controllers.js | 37 +++++++++++++++++++++++ 4 files changed, 67 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/abfabb9e/src/webui/master/static/agent.html ---------------------------------------------------------------------- diff --git a/src/webui/master/static/agent.html b/src/webui/master/static/agent.html index 416e6c2..03ba7a8 100644 --- a/src/webui/master/static/agent.html +++ b/src/webui/master/static/agent.html @@ -129,6 +129,7 @@ <th data-key="id">ID</th> <th data-key="user">User</th> <th data-key="name">Name</th> + <th data-key="roles">Roles</th> <th data-key="num_tasks">Active Tasks</th> <th data-key="cpus">CPUs (Used / Allocated)</th> <th data-key="gpus">GPUs (Used / Allocated)</th> @@ -151,6 +152,11 @@ </td> <td>{{framework.user}}</td> <td>{{framework.name}}</td> + <!-- TODO(bmahler): This doesn't display well when there are a lot + of roles (e.g. a large organization with a lot of teams & + services, using roles like /engineering/frontend/webserver, etc). + Figure out a way to display this without bloating the table. --> + <td>{{framework.roles.toString()}}</td> <td>{{framework.num_tasks | number}}</td> <td>{{monitor.frameworks[framework.id].statistics.cpus_total_usage | number}} / {{framework.cpus | number}}</td> <!-- TODO(haosdent): We need to show statistics for gpu once it is provided in monitor endpoint. --> @@ -168,6 +174,7 @@ <th data-key="id">ID</th> <th data-key="user">User</th> <th data-key="name">Name</th> + <th data-key="roles">Roles</th> <th data-key="tasks.length">Active Tasks</th> <th data-key="resources.cpus">CPUs</th> <th data-key="resources.gpus">GPUs</th> @@ -190,6 +197,11 @@ </td> <td>{{completed_framework.user}}</td> <td>{{completed_framework.name}}</td> + <!-- TODO(bmahler): This doesn't display well when there are a lot + of roles (e.g. a large organization with a lot of teams & + services, using roles like /engineering/frontend/webserver, etc). + Figure out a way to display this without bloating the table. --> + <td>{{completed_framework.roles.toString()}}</td> <td>{{completed_framework.num_tasks | number}}</td> <td>{{completed_framework.cpus | number}}</td> <td>{{completed_framework.gpus | number}}</td> http://git-wip-us.apache.org/repos/asf/mesos/blob/abfabb9e/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 95e921d..d9427c1 100644 --- a/src/webui/master/static/agent_executor.html +++ b/src/webui/master/static/agent_executor.html @@ -29,6 +29,8 @@ <dd>{{executor.name}}</dd> <dt>Executor Source:</dt> <dd>{{executor.source}}</dd> + <dt>Executor Role:</dt> + <dd>{{executor.role}}</dd> </dl> <dl class="inline clearfix"> @@ -106,6 +108,7 @@ <tr> <th data-key="id">ID</th> <th data-key="name">Name</th> + <th data-key="role">Role</th> <th data-key="resources.cpus">CPUs</th> <th data-key="resources.gpus">GPUs</th> <th data-key="resources.mem">Mem</th> @@ -116,6 +119,7 @@ <tr ng-repeat="queued_task in $data"> <td>{{queued_task.id}}</td> <td>{{queued_task.name}}</td> + <td>{{queued_task.role}}</td> <td>{{queued_task.resources.cpus | number}}</td> <td>{{queued_task.resources.gpus | number}}</td> <td>{{queued_task.resources.mem * (1024 * 1024) | dataSize}}</td> @@ -130,6 +134,7 @@ <tr> <th data-key="id">ID</th> <th data-key="name">Name</th> + <th data-key="role">Role</th> <th data-key="state">State</th> <th data-key="resources.cpus">CPUs (allocated)</th> <th data-key="resources.gpus">GPUs (allocated)</th> @@ -142,6 +147,7 @@ <tr ng-repeat="task in $data"> <td>{{task.id}}</td> <td>{{task.name}}</td> + <td>{{task.role}}</td> <td>{{task.state}}</td> <td>{{task.resources.cpus | number}}</td> <td>{{task.resources.gpus | number}}</td> @@ -163,6 +169,7 @@ <tr> <th data-key="id">ID</th> <th data-key="name">Name</th> + <th data-key="role">Role</th> <th data-key="state">State</th> <th data-key="resources.cpus">CPUs (allocated)</th> <th data-key="resources.gpus">GPUs (allocated)</th> @@ -175,6 +182,7 @@ <tr ng-repeat="completed_task in $data"> <td>{{completed_task.id}}</td> <td>{{completed_task.name}}</td> + <td>{{completed_task.role}}</td> <td>{{completed_task.state}}</td> <td>{{completed_task.resources.cpus | number}}</td> <td>{{completed_task.resources.gpus | number}}</td> http://git-wip-us.apache.org/repos/asf/mesos/blob/abfabb9e/src/webui/master/static/agent_framework.html ---------------------------------------------------------------------- diff --git a/src/webui/master/static/agent_framework.html b/src/webui/master/static/agent_framework.html index 806ab06..e2a4033 100644 --- a/src/webui/master/static/agent_framework.html +++ b/src/webui/master/static/agent_framework.html @@ -23,6 +23,12 @@ <dl class="inline clearfix"> <dt>Name:</dt><dd>{{framework.name}}</dd> <dt>Master:</dt><dd>{{state.master_hostname}}</dd> + <!-- TODO(bmahler): Consider having a break between each role + in order to increase readability. Also, this doesn't + display well when there are a lot of roles (e.g. a large + organization with a lot of teams & services, using roles + like /engineering/frontend/webserver, etc). --> + <dt>Roles:</dt><dd>{{framework.roles.toString()}}</dd> </dl> <dl class="inline clearfix"> @@ -83,6 +89,7 @@ <th data-key="id">ID</th> <th data-key="name">Name</th> <th data-key="source">Source</th> + <th data-key="role">Role</th> <th data-key="tasks.length">Active Tasks</th> <th data-key="queued_tasks.length">Queued Tasks</th> <th data-key="resources.cpus">CPUs (Used / Allocated)</th> @@ -101,6 +108,7 @@ </td> <td>{{executor.name}}</td> <td>{{executor.source}}</td> + <td>{{executor.role}}</td> <td>{{executor.tasks.length | number}}</td> <td>{{executor.queued_tasks.length | number}}</td> <td>{{monitor.frameworks[framework.id].executors[executor.id].statistics.cpus_total_usage | number}} / @@ -128,6 +136,7 @@ <th data-key="id">ID</th> <th data-key="name">Name</th> <th data-key="source">Source</th> + <th data-key="role">Role</th> <th data-key="sandbox">Sandbox</th> </tr> </thead> @@ -140,6 +149,7 @@ </td> <td>{{completed_executor.name}}</td> <td>{{completed_executor.source}}</td> + <td>{{completed_executor.role}}</td> <td> <a href="{{'#/agents/' + agent_id + '/browse?path=' + encodeURIComponent(completed_executor.directory)}}"> http://git-wip-us.apache.org/repos/asf/mesos/blob/abfabb9e/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 2ea8275..3620047 100644 --- a/src/webui/master/static/js/controllers.js +++ b/src/webui/master/static/js/controllers.js @@ -578,11 +578,21 @@ _.each($scope.state.frameworks, function(framework) { $scope.agent.frameworks[framework.id] = framework; computeFrameworkStats(framework); + + // Fill in the `roles` field for non-MULTI_ROLE schedulers. + if (framework.role) { + framework.roles = [framework.role]; + } }); _.each($scope.state.completed_frameworks, function(framework) { $scope.agent.completed_frameworks[framework.id] = framework; computeFrameworkStats(framework); + + // Fill in the `roles` field for non-MULTI_ROLE schedulers. + if (framework.role) { + framework.roles = [framework.role]; + } }); $('#agent').show(); @@ -662,6 +672,11 @@ return; } + // Fill in the `roles` field for non-MULTI_ROLE schedulers. + if ($scope.framework.role) { + $scope.framework.roles = [$scope.framework.role]; + } + // Compute the framework stats. $scope.framework.num_tasks = 0; $scope.framework.cpus = 0; @@ -675,6 +690,11 @@ $scope.framework.gpus += executor.resources.gpus; $scope.framework.mem += executor.resources.mem; $scope.framework.disk += executor.resources.disk; + + // If 'role' is not present in executor, we are talking + // to a non-MULTI_ROLE capable agent. This means that we + // can use the 'role' of the framework. + executor.role = executor.role || $scope.framework.role; }); $('#agent').show(); @@ -754,6 +774,23 @@ return; } + // If 'role' is not present in the task, we are talking + // to a non-MULTI_ROLE capable agent. This means that we + // can use the 'role' of the framework. + if (!("role" in $scope.executor)) { + $scope.executor.role = $scope.framework.role; + + function setRole(tasks) { + _.each(tasks, function(task) { + task.role = $scope.framework.role; + }); + } + + setRole($scope.executor.tasks); + setRole($scope.executor.queued_tasks); + setRole($scope.executor.completed_tasks); + } + setTaskSandbox($scope.executor); $('#agent').show();
