YARN-8947. [UI2] Active User info missing from UI2. Contributed by Akhil PB.

This commit is contained in:
Sunil G 2019-06-03 12:24:20 +05:30
parent 2a97a37d9e
commit 7f46dda513
4 changed files with 84 additions and 3 deletions

View File

@ -22,5 +22,14 @@ export default DS.Model.extend({
name: DS.attr('string'), name: DS.attr('string'),
queueName: DS.attr('string'), queueName: DS.attr('string'),
usedMemoryMB: DS.attr('number'), usedMemoryMB: DS.attr('number'),
usedVCore: DS.attr('number') usedVCore: DS.attr('number'),
maxMemoryMB: DS.attr('number'),
maxVCore: DS.attr('number'),
amUsedMemoryMB: DS.attr('number'),
amUsedVCore: DS.attr('number'),
maxAMMemoryMB: DS.attr('number'),
maxAMVCore: DS.attr('number'),
userWeight: DS.attr('string'),
activeApps: DS.attr('number'),
pendingApps: DS.attr('number')
}); });

View File

@ -36,6 +36,8 @@ export default DS.JSONAPISerializer.extend({
// update user models // update user models
if (payload.users && payload.users.user) { if (payload.users && payload.users.user) {
payload.users.user.forEach(function(u) { payload.users.user.forEach(function(u) {
var defaultPartitionResource = u.resources.resourceUsagesByPartition[0];
var maxAMResource = defaultPartitionResource.amLimit;
includedData.push({ includedData.push({
type: "YarnUser", type: "YarnUser",
id: u.username + "_" + payload.queueName, id: u.username + "_" + payload.queueName,
@ -44,6 +46,15 @@ export default DS.JSONAPISerializer.extend({
queueName: payload.queueName, queueName: payload.queueName,
usedMemoryMB: u.resourcesUsed.memory || 0, usedMemoryMB: u.resourcesUsed.memory || 0,
usedVCore: u.resourcesUsed.vCores || 0, usedVCore: u.resourcesUsed.vCores || 0,
maxMemoryMB: u.userResourceLimit.memory || 0,
maxVCore: u.userResourceLimit.vCores || 0,
amUsedMemoryMB: u.AMResourceUsed.memory || 0,
amUsedVCore: u.AMResourceUsed.vCores || 0,
maxAMMemoryMB: maxAMResource.memory || 0,
maxAMVCore: maxAMResource.vCores || 0,
userWeight: u.userWeight || '',
activeApps: u.numActiveApplications || 0,
pendingApps: u.numPendingApplications || 0
} }
}); });

View File

@ -755,3 +755,21 @@ div.loggedin-user {
border-radius: 2px; border-radius: 2px;
} }
} }
/**
* Active User Info table styles
*/
.active-user-panel {
margin-top: 10px;
}
table.active-user-table {
border: 1px solid #ddd;
> thead > tr > th {
background-color: #f7f7f7;
}
&.table-bordered > thead > tr > th,
&.table-bordered > tbody > tr > td {
border: 1px solid #dcdcdc !important;
}
}

View File

@ -17,7 +17,7 @@
}} }}
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12 col-md-12">
<div class="row"> <div class="row">
{{#if (eq model.queues.firstObject.type "capacity")}} {{#if (eq model.queues.firstObject.type "capacity")}}
{{yarn-queue.capacity-queue-info model=model}} {{yarn-queue.capacity-queue-info model=model}}
@ -28,7 +28,7 @@
{{/if}} {{/if}}
</div> </div>
</div> </div>
<div class="col-lg-12 yarn-applications-container"> <div class="col-lg-12 col-md-12 yarn-applications-container">
{{#if model.apps}} {{#if model.apps}}
{{em-table columns=columns rows=model.apps definition=tableDefinitio}} {{em-table columns=columns rows=model.apps definition=tableDefinitio}}
{{else}} {{else}}
@ -38,4 +38,47 @@
</div> </div>
{{/if}} {{/if}}
</div> </div>
{{!-- Active User Info --}}
{{#if model.selectedQueue.users}}
<div class="col-lg-12 col-md-12">
<div class="panel panel-default active-user-panel">
<div class="panel-heading">
Active User Info: {{ model.selected }}
</div>
<div class="panel-body">
<table class="table table-striped table-bordered active-user-table">
<thead>
<tr>
<th>User Name</th>
<th>Max Resource</th>
<th>Used Resource</th>
<th>Max AM Resource</th>
<th>Used AM Resource</th>
<th>Active Apps</th>
<th>Pending Apps</th>
<th>Weight</th>
</tr>
</thead>
<tbody>
<tr style="display: none">
{{!-- Fix to start odd row background color from third row --}}
</tr>
{{#each model.selectedQueue.users as |user|}}
<tr>
<td>{{ user.name }}</td>
<td>&lt;memory: {{user.maxMemoryMB}} MB, vCores: {{user.maxVCore}}&gt;</td>
<td>&lt;memory: {{user.usedMemoryMB}} MB, vCores: {{user.usedVCore}}&gt;</td>
<td>&lt;memory: {{user.maxAMMemoryMB}} MB, vCores: {{user.maxAMVCore}}&gt;</td>
<td>&lt;memory: {{user.amUsedMemoryMB}} MB, vCores: {{user.amUsedVCore}}&gt;</td>
<td>{{user.activeApps}}</td>
<td>{{user.pendingApps}}</td>
<td>{{user.userWeight}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</div>
{{/if}}
</div> </div>