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:43 UTC

[mesos] branch master updated (9862262 -> 50c37a6)

This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git.


    from 9862262  Fixed flaky check in cluster::Slave destructor.
     new dd2605e  Added resource provider information to v0 agent state endpoint.
     new 50c37a6  Displayed resource provider information in the Mesos webui.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/slave/http.cpp              | 34 +++++++++++++++++++++++++++++++---
 src/webui/app/agents/agent.html | 36 ++++++++++++++++++++++++++++++++++++
 src/webui/app/controllers.js    | 25 ++++++++++++++++++++++++-
 3 files changed, 91 insertions(+), 4 deletions(-)


[mesos] 01/02: Added resource provider information to v0 agent state endpoint.

Posted by bb...@apache.org.
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 dd2605efabff656cfba0218855d4b2dbfcba3051
Author: Benjamin Bannier <be...@mesosphere.io>
AuthorDate: Fri Jan 11 09:27:58 2019 +0100

    Added resource provider information to v0 agent state endpoint.
    
    Review: https://reviews.apache.org/r/69661/
---
 src/slave/http.cpp | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index 6ef99fb..e0dc091 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -1276,9 +1276,14 @@ Future<Response> Http::state(
   }
 
   return ObjectApprovers::create(
-      slave->authorizer,
-      principal,
-      {VIEW_FRAMEWORK, VIEW_TASK, VIEW_EXECUTOR, VIEW_FLAGS, VIEW_ROLE})
+             slave->authorizer,
+             principal,
+             {VIEW_FRAMEWORK,
+              VIEW_TASK,
+              VIEW_EXECUTOR,
+              VIEW_FLAGS,
+              VIEW_ROLE,
+              VIEW_RESOURCE_PROVIDER})
     .then(defer(
         slave->self(),
         [this, request](const Owned<ObjectApprovers>& approvers) -> Response {
@@ -1384,6 +1389,29 @@ Future<Response> Http::state(
                 "unreserved_resources_allocated",
                 allocatedResources.unreserved());
 
+            writer->field(
+                "resource_providers",
+                [this, &approvers](JSON::ArrayWriter* writer) {
+                  if (!approvers->approved<VIEW_RESOURCE_PROVIDER>()) {
+                    return;
+                  }
+
+                  foreachvalue (
+                      ResourceProvider* resourceProvider,
+                      slave->resourceProviders) {
+                    agent::Response::GetResourceProviders::ResourceProvider
+                      provider;
+
+                    *provider.mutable_resource_provider_info() =
+                      resourceProvider->info;
+
+                    *provider.mutable_total_resources() =
+                      resourceProvider->totalResources;
+
+                    writer->element(JSON::Protobuf(provider));
+                  }
+                });
+
             writer->field("attributes", Attributes(slave->info.attributes()));
 
             if (slave->master.isSome()) {


[mesos] 02/02: Displayed resource provider information in the Mesos webui.

Posted by bb...@apache.org.
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) {