YARN-8608. [UI2] No information available per application appAttempt about 'Total Outstanding Resource Requests'. Contributed by Akhil PB.

This commit is contained in:
Rohith Sharma K S 2018-08-03 13:59:34 +05:30
parent 33482d35e8
commit 022592ae79
3 changed files with 53 additions and 22 deletions

View File

@ -35,16 +35,16 @@ export default Ember.Controller.extend({
Ember.$("#stopServiceConfirmDialog").modal('hide'); Ember.$("#stopServiceConfirmDialog").modal('hide');
var adapter = this.store.adapterFor('yarn-servicedef'); var adapter = this.store.adapterFor('yarn-servicedef');
self.set('isLoading', true); self.set('isLoading', true);
adapter.stopService(this.get('service'), this.get('model.app.user')).then(function() { adapter.stopService(this.get('service'), this.get('model.app.user')).then(function () {
self.set('actionResponse', {msg: 'Service stopped successfully. Auto refreshing in 5 seconds.', type: 'success'}); self.set('actionResponse', { msg: 'Service stopped successfully. Auto refreshing in 5 seconds.', type: 'success' });
Ember.run.later(self, function() { Ember.run.later(self, function () {
this.set('actionResponse', null); this.set('actionResponse', null);
this.send("refresh"); this.send("refresh");
}, 5000); }, 5000);
}, function(errr) { }, function (errr) {
let messg = errr.diagnostics || 'Error: Stop service failed!'; let messg = errr.diagnostics || 'Error: Stop service failed!';
self.set('actionResponse', {msg: messg, type: 'error'}); self.set('actionResponse', { msg: messg, type: 'error' });
}).finally(function() { }).finally(function () {
self.set('isLoading', false); self.set('isLoading', false);
}); });
}, },
@ -59,16 +59,16 @@ export default Ember.Controller.extend({
Ember.$("#deleteServiceConfirmDialog").modal('hide'); Ember.$("#deleteServiceConfirmDialog").modal('hide');
var adapter = this.store.adapterFor('yarn-servicedef'); var adapter = this.store.adapterFor('yarn-servicedef');
self.set('isLoading', true); self.set('isLoading', true);
adapter.deleteService(this.get('service'), this.get('model.app.user')).then(function() { adapter.deleteService(this.get('service'), this.get('model.app.user')).then(function () {
self.set('actionResponse', {msg: 'Service deleted successfully. Redirecting to services in 5 seconds.', type: 'success'}); self.set('actionResponse', { msg: 'Service deleted successfully. Redirecting to services in 5 seconds.', type: 'success' });
Ember.run.later(self, function() { Ember.run.later(self, function () {
this.set('actionResponse', null); this.set('actionResponse', null);
this.transitionToRoute("yarn-services"); this.transitionToRoute("yarn-services");
}, 5000); }, 5000);
}, function(errr) { }, function (errr) {
let messg = errr.diagnostics || 'Error: Delete service failed!'; let messg = errr.diagnostics || 'Error: Delete service failed!';
self.set('actionResponse', {msg: messg, type: 'error'}); self.set('actionResponse', { msg: messg, type: 'error' });
}).finally(function() { }).finally(function () {
self.set('isLoading', false); self.set('isLoading', false);
}); });
}, },
@ -78,15 +78,32 @@ export default Ember.Controller.extend({
} }
}, },
isRunningService: Ember.computed('model.serviceName', 'model.app.state', function() { isRunningService: Ember.computed('model.serviceName', 'model.app.state', function () {
return this.get('service') !== undefined && this.get('model.app.state') === 'RUNNING'; return this.get('service') !== undefined && this.get('model.app.state') === 'RUNNING';
}), }),
amHostHttpAddressFormatted: Ember.computed('model.app.amHostHttpAddress', function() { amHostHttpAddressFormatted: Ember.computed('model.app.amHostHttpAddress', function () {
var amHostAddress = this.get('model.app.amHostHttpAddress'); var amHostAddress = this.get('model.app.amHostHttpAddress');
if (amHostAddress && amHostAddress.indexOf('://') < 0) { if (amHostAddress && amHostAddress.indexOf('://') < 0) {
amHostAddress = 'http://' + amHostAddress; amHostAddress = 'http://' + amHostAddress;
} }
return amHostAddress; return amHostAddress;
}),
totalOutstandingResourceRequests: Ember.computed('model.app.resourceRequests', function() {
const resourceRequests = this.get('model.app.resourceRequests');
if (resourceRequests) {
const totatResourceRequests = { memory: 0, vCores: 0 };
[].forEach.call(resourceRequests, resource => {
if (resource.resourceName === '*') {
const totalMemory = resource.capability.resourceInformations.resourceInformation[0].value * resource.numContainers;
const totalVCores = resource.capability.resourceInformations.resourceInformation[1].value * resource.numContainers;
totatResourceRequests.memory += totalMemory;
totatResourceRequests.vCores += totalVCores;
}
});
return totatResourceRequests;
}
return null;
}) })
}); });

View File

@ -75,8 +75,9 @@
<div class="links"> <div class="links">
{{#if (or isRunningService isKillable)}} {{#if (or isRunningService isKillable)}}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-unstyled dropdown-toggle" title="Settings" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-unstyled dropdown-toggle" title="Settings"
<i class="glyphicon glyphicon-cog" /> data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="margin-left: -5px;">
<i class="glyphicon glyphicon-cog"/> Settings
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
{{#if isRunningService}} {{#if isRunningService}}
@ -113,9 +114,11 @@
{{/if}} {{/if}}
</div> </div>
<div> <div>
<span title="Queue" class="yarn-tooltip"><i class="glyphicon glyphicon-tasks glyphicon-gray" />{{model.app.queue}}</span> <span title="Queue" class="yarn-tooltip">
<i class="glyphicon glyphicon-tasks glyphicon-gray" /> {{model.app.queue}}
</span>
</div> </div>
<div>Priority {{model.app.priority}}</div> <div>Priority: {{model.app.priority}}</div>
{{#if model.app.trackingUrl}} {{#if model.app.trackingUrl}}
<div><a href="{{model.app.trackingUrl}}" target="_blank">{{model.app.trackingUI}}</a></div> <div><a href="{{model.app.trackingUrl}}" target="_blank">{{model.app.trackingUI}}</a></div>
{{/if}} {{/if}}

View File

@ -58,12 +58,20 @@
{{#unless model.serviceName}} {{#unless model.serviceName}}
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Outstanding Resource Requests</div> <div class="panel-heading">
Outstanding Resource Requests
{{#if totalOutstandingResourceRequests}}
<span class="pull-right">
Total: &lt;Memory: {{totalOutstandingResourceRequests.memory}},
vCores: {{totalOutstandingResourceRequests.vCores}}&gt;
</span>
{{/if}}
</div>
<table class="display table table-striped table-bordered" <table class="display table table-striped table-bordered"
cellspacing="0" width="100%"> cellspacing="0" width="100%">
<thead> <thead>
<tr> <tr>
<th>Scheduler Key</th> <th>Priority</th>
<th>Resource Name</th> <th>Resource Name</th>
<th>Capability</th> <th>Capability</th>
<th># Containers</th> <th># Containers</th>
@ -76,7 +84,8 @@
<tr> <tr>
<td>{{request.priority}}</td> <td>{{request.priority}}</td>
<td>{{request.resourceName}}</td> <td>{{request.resourceName}}</td>
<td>&lt;Memory:{{request.capability.memory}};vCores:{{request.capability.virtualCores}}&gt;</td> <td>&lt;Memory: {{request.capability.resourceInformations.resourceInformation.[0].value}},
vCores: {{request.capability.resourceInformations.resourceInformation.[1].value}}&gt;</td>
<td>{{request.numContainers}}</td> <td>{{request.numContainers}}</td>
<td>{{request.relaxLocality}}</td> <td>{{request.relaxLocality}}</td>
<td> <td>
@ -88,7 +97,9 @@
</td> </td>
</tr> </tr>
{{else}} {{else}}
<div class="panel-body">No data available!</div> <tr>
<td class="text-center" colspan="6">No data available!</td>
</tr>
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>