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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4b15fbd  Exposed agent drain information in the webui.
4b15fbd is described below

commit 4b15fbdde14eed3a6dbd5c95d271bc26eb7216e2
Author: Benjamin Bannier <[email protected]>
AuthorDate: Thu Jul 25 09:35:40 2019 -0700

    Exposed agent drain information in the webui.
    
    Review: https://reviews.apache.org/r/71081/
---
 src/webui/app/agents/agent.html  | 10 ++++++++++
 src/webui/app/agents/agents.html |  2 ++
 src/webui/app/controllers.js     | 11 +++++++++++
 3 files changed, 23 insertions(+)

diff --git a/src/webui/app/agents/agent.html b/src/webui/app/agents/agent.html
index 6d50bfd..25d233b 100644
--- a/src/webui/app/agents/agent.html
+++ b/src/webui/app/agents/agent.html
@@ -56,6 +56,16 @@
         </span>
       </p>
 
+      <span ng-if="agent.drain_config">
+        <h4>Draining</h4>
+        <dl class="inline clearfix">
+          <dt>Mark gone:</dt>
+          <dd>{{agent.drain_config.mark_gone}}</dd>
+          <dt>Max. grace period:</dt>
+          <dd>{{agent.drain_config.max_grace_period.nanoseconds / 1000000000}} 
seconds</dd>
+        </dl>
+      </span>
+
       <h4>Tasks</h4>
       <table class="table table-condensed">
         <tbody>
diff --git a/src/webui/app/agents/agents.html b/src/webui/app/agents/agents.html
index 98712c6..0c6d330 100644
--- a/src/webui/app/agents/agents.html
+++ b/src/webui/app/agents/agents.html
@@ -13,6 +13,7 @@
     <tr>
       <th data-key="id">ID</th>
       <th data-key="hostname">Host</th>
+      <th data-key="draining">State</th>
       <th data-key="resources.cpus">CPUs (Allocated / Total)</th>
       <th data-key="resources.gpus">GPUs (Allocated / Total)</th>
       <th data-key="resources.mem">Mem (Allocated / Total)</th>
@@ -34,6 +35,7 @@
       </button>
     </td>
     <td>{{agent.hostname}}</td>
+    <td>{{agent.state}}</td>
     <td>
       {{agent.used_resources.cpus | number}} / {{agent.resources.cpus | 
number}}
     </td>
diff --git a/src/webui/app/controllers.js b/src/webui/app/controllers.js
index 66cd32e..725230f 100644
--- a/src/webui/app/controllers.js
+++ b/src/webui/app/controllers.js
@@ -198,6 +198,17 @@
     $scope.unreachable_agents = $scope.state.unreachable_slaves;
 
     _.each($scope.state.slaves, function(agent) {
+      // Calculate the agent "state" from activation and drain state.
+      if (!agent.deactivated) {
+        agent.state = "Active";
+      } else if (agent.drain_info) {
+        // Transform the drain state so only the first letter is capitalized.
+        var s = agent.drain_info.state;
+        agent.state = s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
+      } else {
+        agent.state = "Deactivated";
+      }
+
       $scope.agents[agent.id] = agent;
       $scope.total_cpus += agent.resources.cpus;
       $scope.total_gpus += agent.resources.gpus;

Reply via email to