You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2019/01/11 08:37:45 UTC
[mesos] 02/02: Displayed resource provider information in the Mesos
webui.
This is an automated email from the ASF dual-hosted git repository.
bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 50c37a6365700f849b51e5ff0cf7ae08c11ee5a7
Author: Benjamin Bannier <be...@mesosphere.io>
AuthorDate: Fri Jan 11 09:28:00 2019 +0100
Displayed resource provider information in the Mesos webui.
Review: https://reviews.apache.org/r/69662/
---
src/webui/app/agents/agent.html | 36 ++++++++++++++++++++++++++++++++++++
src/webui/app/controllers.js | 25 ++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/src/webui/app/agents/agent.html b/src/webui/app/agents/agent.html
index a101a93..6d50bfd 100644
--- a/src/webui/app/agents/agent.html
+++ b/src/webui/app/agents/agent.html
@@ -171,6 +171,42 @@
</div>
</div>
+
+ <!-- Only display this table if resource providers are present. -->
+ <div class="col-md-9" ng-if="!_.isEmpty(agent.resource_providers)">
+ <table m-table table-content="agent.resource_providers"
+ title="Resource Providers"
+ class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th data-key="id">ID</th>
+ <th data-key="name">Name</th>
+ <th data-key="type">Type</th>
+ <!-- TODO(bbannier): Show all resources in stringified representation. -->
+ <th data-key="disk">Disk</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="provider in $data">
+ <td>
+ {{provider.resource_provider_info.id.value | truncateMesosID}}
+ <button class="btn btn-xs btn-default btn-toggle"
+ clipboard
+ data-clipboard-text="{{provider.resource_provider_info.id.value}}"
+ tooltip="Copy ID"
+ tooltip-placement="right"
+ tooltip-trigger="clipboardhover">
+ <i class="icon-file"></i>
+ </button>
+ </td>
+ <td>{{provider.resource_provider_info.name}}</td>
+ <td>{{provider.resource_provider_info.type}}</td>
+ <td>{{provider.total_resources.disk * (1024 * 1024) | dataSize}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </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">
diff --git a/src/webui/app/controllers.js b/src/webui/app/controllers.js
index 8049cf6..42a9fb6 100644
--- a/src/webui/app/controllers.js
+++ b/src/webui/app/controllers.js
@@ -688,12 +688,13 @@
}
$http.jsonp(agentURLPrefix(agent, true) + '/state?jsonp=JSON_CALLBACK')
- .success(function (response) {
+ .success(function(response) {
$scope.state = response;
$scope.agent = {};
$scope.agent.frameworks = {};
$scope.agent.completed_frameworks = {};
+ $scope.agent.resource_providers = {};
$scope.agent.url_prefix = agentURLPrefix(agent, false);
// The agent attaches a "/slave/log" file when either
@@ -708,6 +709,28 @@
return reservation;
});
+ // Compute resource provider information.
+ _.each($scope.state.resource_providers, function(provider) {
+ // Store a summarized representation of the resource provider's
+ // total scalar resources in the `total_resources` field; the full
+ // original data is available under `total_resources_full`.
+ provider.total_resources_full = _.clone(provider.total_resources);
+ // provider.total_resources = {};
+ _.each(provider.total_resources_full, function(resource) {
+ if (resource.type != "SCALAR") {
+ return;
+ }
+
+ if (!provider.total_resources[resource.name]) {
+ provider.total_resources[resource.name] = 0;
+ }
+
+ provider.total_resources[resource.name] += resource.scalar.value;
+ });
+
+ $scope.agent.resource_providers[provider.resource_provider_info.id.value] = provider;
+ });
+
// Computes framework stats by setting new attributes on the 'framework'
// object.
function computeFrameworkStats(framework) {