| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122 |
1
1
1
1
2
2
1
1
1
1
1
1
11
11
11
11
4
4
12
12
8
8
8
8
8
8
4
12
4
11
11
1
| 'use strict';
;require.register("models/service/yarn", function (exports, require, module) {
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
var App = require('app');
var objectUtils = require('utils/object_utils');
App.YARNService = App.Service.extend({
resourceManager: DS.belongsTo('App.HostComponent'),
isRMHaEnabled: function () {
return this.get('hostComponents').filterProperty('componentName', 'RESOURCEMANAGER').length > 1;
}.property('hostComponents'),
activeResourceManager: DS.belongsTo('App.HostComponent'),
appTimelineServer: DS.belongsTo('App.HostComponent'),
nodeManagersStarted: DS.attr('number'),
nodeManagersInstalled: DS.attr('number'),
nodeManagersTotal: DS.attr('number'),
nodeManagersCountActive: DS.attr('number'),
nodeManagersCountLost: DS.attr('number'),
nodeManagersCountUnhealthy: DS.attr('number'),
nodeManagersCountRebooted: DS.attr('number'),
nodeManagersCountDecommissioned: DS.attr('number'),
containersAllocated: DS.attr('number'),
containersPending: DS.attr('number'),
containersReserved: DS.attr('number'),
appsSubmitted: DS.attr('number'),
appsRunning: DS.attr('number'),
appsPending: DS.attr('number'),
appsCompleted: DS.attr('number'),
appsKilled: DS.attr('number'),
appsFailed: DS.attr('number'),
ahsWebPort: function () {
var yarnConf = App.db.getConfigs().findProperty('type', 'yarn-site');
if (yarnConf) {
return yarnConf.properties['yarn.timeline-service.webapp.address'].match(/:(\d+)/)[1];
}
return "8188";
}.property(),
resourceManagerStartTime: DS.attr('number'),
jvmMemoryHeapUsed: DS.attr('number'),
jvmMemoryHeapMax: DS.attr('number'),
allocatedMemory: DS.attr('number'),
reservedMemory: DS.attr('number'),
availableMemory: DS.attr('number'),
queue: DS.attr('string'),
queueFormatted: function () {
var queue = JSON.parse(this.get('queue'));
return objectUtils.recursiveTree(queue);
}.property('queue'),
queuesCount: function () {
var queue = JSON.parse(this.get('queue'));
return objectUtils.recursiveKeysCount(queue);
}.property('queue'),
allQueueNames: [],
childQueueNames: [],
maxMemory: Em.computed.sumProperties('allocatedMemory', 'availableMemory'),
/**
* Provides a flat array of queue names.
* Example: root, root/default
*/
queueNames: function () {
var queueString = this.get('queue');
var allQueueNames = [];
var childQueueNames = [];
if (queueString != null) {
var queues = JSON.parse(queueString);
var addQueues = function addQueues(queuesObj, path) {
var names = [];
for (var subQueue in queuesObj) {
Eif (queuesObj[subQueue] instanceof Object) {
var qFN = path == '' ? subQueue : path + '/' + subQueue;
names.push(qFN);
var subNames = addQueues(queuesObj[subQueue], qFN);
names = names.concat(subNames);
if (!subNames || subNames.length < 1) {
childQueueNames.push(qFN);
}
}
}
return names;
};
allQueueNames = addQueues(queues, '');
}
this.set('allQueueNames', allQueueNames);
this.set('childQueueNames', childQueueNames);
}.observes('queue')
/**
* ResourceManager's lost count is not accurate once RM is rebooted. Since
* Ambari knows the total number of nodes and the counts of nodes in other
* states, we calculate the lost count.
*
nodeManagersCountLost: function () {
var totalCount = this.get('nodeManagersTotal');
var activeCount = this.get('nodeManagersCountActive');
var rebootedCount = this.get('nodeManagersCountRebooted');
var unhealthyCount = this.get('nodeManagersCountUnhealthy');
var decomCount = this.get('nodeManagersCountDecommissioned');
var nonLostHostsCount = activeCount + rebootedCount + decomCount + unhealthyCount;
return totalCount >= nonLostHostsCount ? totalCount - nonLostHostsCount : 0;
}.property('nodeManagersTotal', 'nodeManagersCountActive', 'nodeManagersCountRebooted', 'nodeManagersCountUnhealthy', 'nodeManagersCountDecommissioned')*/
});
App.YARNService.FIXTURES = [];
}); |