|
@@ -21,17 +21,29 @@ require('utils/configs/defaults_providers/yarn_defaults_provider');
|
|
|
|
|
|
describe('YARNDefaultsProvider', function() {
|
|
|
|
|
|
+ afterEach(function() {
|
|
|
+ App.YARNDefaultsProvider.set('clusterData', null);
|
|
|
+ App.YARNDefaultsProvider.set('reservedRam', null);
|
|
|
+ App.YARNDefaultsProvider.set('hBaseRam', null);
|
|
|
+ App.YARNDefaultsProvider.set('containers', null);
|
|
|
+ App.YARNDefaultsProvider.set('recommendedMinimumContainerSize', null);
|
|
|
+ App.YARNDefaultsProvider.set('ramPerContainer', null);
|
|
|
+ App.YARNDefaultsProvider.set('mapMemory', null);
|
|
|
+ App.YARNDefaultsProvider.set('reduceMemory', null);
|
|
|
+ App.YARNDefaultsProvider.set('amMemory', null);
|
|
|
+ });
|
|
|
+
|
|
|
describe('#clusterDataIsValid', function() {
|
|
|
var tests = [
|
|
|
- {clusterData: {disk: 12,ram: 48 * 1024,cpu: 12,hBaseInstalled: false},e: true},
|
|
|
- {clusterData: {disk: null,ram: 48 * 1024,cpu: 12,hBaseInstalled: false},e: false},
|
|
|
+ {clusterData: {disk: 12,ram: 48,cpu: 12,hBaseInstalled: false},e: true},
|
|
|
+ {clusterData: {disk: null,ram: 48,cpu: 12,hBaseInstalled: false},e: false},
|
|
|
{clusterData: {disk: 12,ram: null,cpu: 12,hBaseInstalled: false},e: false},
|
|
|
- {clusterData: {disk: 12,ram: 48 * 1024,cpu: null,hBaseInstalled: false},e: false},
|
|
|
- {clusterData: {disk: 12,ram: 48 * 1024,cpu: 12,hBaseInstalled: null},e: false},
|
|
|
- {clusterData: {disk: 12,ram: 48 * 1024,cpu: 12},e: false},
|
|
|
- {clusterData: {disk: 12,ram: 48 * 1024,hBaseInstalled: true},e: false},
|
|
|
+ {clusterData: {disk: 12,ram: 48,cpu: null,hBaseInstalled: false},e: false},
|
|
|
+ {clusterData: {disk: 12,ram: 48,cpu: 12,hBaseInstalled: null},e: false},
|
|
|
+ {clusterData: {disk: 12,ram: 48,cpu: 12},e: false},
|
|
|
+ {clusterData: {disk: 12,ram: 48,hBaseInstalled: true},e: false},
|
|
|
{clusterData: {disk: 12,cpu: 12,hBaseInstalled: true},e: false},
|
|
|
- {clusterData: {ram: 48 * 1024,cpu: 12,hBaseInstalled: false},e: false}
|
|
|
+ {clusterData: {ram: 48,cpu: 12,hBaseInstalled: false},e: false}
|
|
|
];
|
|
|
tests.forEach(function(test) {
|
|
|
it((test.e?'valid':'invalid') + ' clusterData', function() {
|
|
@@ -71,14 +83,17 @@ describe('YARNDefaultsProvider', function() {
|
|
|
App.YARNDefaultsProvider.set('clusterData');
|
|
|
tests.forEach(function(test) {
|
|
|
it('ram: ' + test.ram + ' GB', function() {
|
|
|
+ sinon.spy(App.YARNDefaultsProvider, 'reservedMemoryRecommendations');
|
|
|
App.YARNDefaultsProvider.set('clusterData', {
|
|
|
disk: 12,
|
|
|
- ram: test.ram * 1024,
|
|
|
+ ram: test.ram,
|
|
|
cpu: 12,
|
|
|
hBaseInstalled: false
|
|
|
});
|
|
|
- expect(App.YARNDefaultsProvider.get('reservedRam')).to.equal(test.e.os * 1024);
|
|
|
- expect(App.YARNDefaultsProvider.get('hBaseRam')).to.equal(test.e.hbase * 1024);
|
|
|
+ expect(App.YARNDefaultsProvider.get('reservedRam')).to.equal(test.e.os);
|
|
|
+ expect(App.YARNDefaultsProvider.get('hBaseRam')).to.equal(test.e.hbase);
|
|
|
+ expect(App.YARNDefaultsProvider.reservedMemoryRecommendations.calledOnce).to.be.true;
|
|
|
+ App.YARNDefaultsProvider.reservedMemoryRecommendations.restore();
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -106,7 +121,7 @@ describe('YARNDefaultsProvider', function() {
|
|
|
it('ram: ' + test.ram + ' GB', function() {
|
|
|
App.YARNDefaultsProvider.set('clusterData', {
|
|
|
disk: 12,
|
|
|
- ram: test.ram * 1024,
|
|
|
+ ram: test.ram,
|
|
|
cpu: 12,
|
|
|
hBaseInstalled: false
|
|
|
});
|
|
@@ -134,7 +149,7 @@ describe('YARNDefaultsProvider', function() {
|
|
|
{
|
|
|
clusterData: {
|
|
|
disk: 12,
|
|
|
- ram: 48 * 1024,
|
|
|
+ ram: 48,
|
|
|
cpu: 12,
|
|
|
hBaseInstalled: false
|
|
|
},
|
|
@@ -142,12 +157,12 @@ describe('YARNDefaultsProvider', function() {
|
|
|
},
|
|
|
{
|
|
|
clusterData: {
|
|
|
- disk: 12,
|
|
|
- ram: 48 * 1024,
|
|
|
- cpu: 12,
|
|
|
+ disk: 6,
|
|
|
+ ram: 48,
|
|
|
+ cpu: 6,
|
|
|
hBaseInstalled: true
|
|
|
},
|
|
|
- e: 17
|
|
|
+ e: 11
|
|
|
}
|
|
|
];
|
|
|
|
|
@@ -169,7 +184,7 @@ describe('YARNDefaultsProvider', function() {
|
|
|
{
|
|
|
clusterData: {
|
|
|
disk: 12,
|
|
|
- ram: 48 * 1024,
|
|
|
+ ram: 48,
|
|
|
cpu: 12,
|
|
|
hBaseInstalled: false
|
|
|
},
|
|
@@ -178,7 +193,7 @@ describe('YARNDefaultsProvider', function() {
|
|
|
{
|
|
|
clusterData: {
|
|
|
disk: 12,
|
|
|
- ram: 16 * 1024,
|
|
|
+ ram: 16,
|
|
|
cpu: 12,
|
|
|
hBaseInstalled: true
|
|
|
},
|
|
@@ -218,12 +233,10 @@ describe('YARNDefaultsProvider', function() {
|
|
|
{
|
|
|
localDB: {
|
|
|
"hosts": {
|
|
|
- "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{},{},{},{},{},{},{},{}]},
|
|
|
- "host2": {"name": "host2","cpu": 4,"memory": "25165824.00","disk_info": [{},{},{},{}]}
|
|
|
+ "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
|
|
|
+ "host2": {"name": "host2","cpu": 4,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
|
|
|
},
|
|
|
- "masterComponentHosts": [
|
|
|
- {"component": "RESOURCEMANAGER","hostName": "host1","serviceId": "HDFS"}
|
|
|
- ],
|
|
|
+ "masterComponentHosts": [],
|
|
|
"slaveComponentHosts": [
|
|
|
{
|
|
|
"componentName": "NODEMANAGER",
|
|
@@ -233,25 +246,25 @@ describe('YARNDefaultsProvider', function() {
|
|
|
},
|
|
|
m: 'Without HBase',
|
|
|
e: {
|
|
|
- 'mapreduce.map.java.opts': 1638,
|
|
|
- 'mapreduce.map.memory.mb': 2048,
|
|
|
- 'mapreduce.reduce.java.opts': 3277,
|
|
|
- 'mapreduce.reduce.memory.mb': 4096,
|
|
|
- 'yarn.app.mapreduce.am.command-opts': 3277,
|
|
|
- 'yarn.app.mapreduce.am.resource.mb': 4096,
|
|
|
- 'yarn.nodemanager.resource.memory-mb': 43008,
|
|
|
- 'yarn.scheduler.maximum-allocation-mb': 43008,
|
|
|
- 'yarn.scheduler.minimum-allocation-mb': 2048
|
|
|
+ 'mapreduce.map.java.opts': '-Xmx2048m',
|
|
|
+ 'mapreduce.map.memory.mb': 2560,
|
|
|
+ 'mapreduce.reduce.java.opts': '-Xmx2048m',
|
|
|
+ 'mapreduce.reduce.memory.mb': 2560,
|
|
|
+ 'yarn.app.mapreduce.am.command-opts': '-Xmx2048m',
|
|
|
+ 'yarn.app.mapreduce.am.resource.mb': 2560,
|
|
|
+ 'yarn.nodemanager.resource.memory-mb': 20480,
|
|
|
+ 'yarn.scheduler.maximum-allocation-mb': 20480,
|
|
|
+ 'yarn.scheduler.minimum-allocation-mb': 2560,
|
|
|
+ 'mapreduce.task.io.sort.mb': 1024
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
localDB: {
|
|
|
"hosts": {
|
|
|
- "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{},{},{},{},{},{},{},{}]},
|
|
|
- "host2": {"name": "host2","cpu": 4,"memory": "12582912.00","disk_info": [{},{},{},{}]}
|
|
|
+ "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
|
|
|
+ "host2": {"name": "host2","cpu": 4,"memory": "12582912.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
|
|
|
},
|
|
|
"masterComponentHosts": [
|
|
|
- {"component": "RESOURCEMANAGER","hostName": "host1","serviceId": "HDFS"},
|
|
|
{"component": "HBASE_MASTER","hostName": "host1","serviceId": "HDFS"}
|
|
|
],
|
|
|
"slaveComponentHosts": [
|
|
@@ -263,15 +276,16 @@ describe('YARNDefaultsProvider', function() {
|
|
|
},
|
|
|
m: 'With HBase',
|
|
|
e: {
|
|
|
- 'mapreduce.map.java.opts': 1638,
|
|
|
- 'mapreduce.map.memory.mb': 2048,
|
|
|
- 'mapreduce.reduce.java.opts': 3277,
|
|
|
- 'mapreduce.reduce.memory.mb': 4096,
|
|
|
- 'yarn.app.mapreduce.am.command-opts': 3277,
|
|
|
- 'yarn.app.mapreduce.am.resource.mb': 4096,
|
|
|
- 'yarn.nodemanager.resource.memory-mb': 22528,
|
|
|
- 'yarn.scheduler.maximum-allocation-mb': 22528,
|
|
|
- 'yarn.scheduler.minimum-allocation-mb': 2048
|
|
|
+ 'mapreduce.map.java.opts': '-Xmx819m',
|
|
|
+ 'mapreduce.map.memory.mb': 1024,
|
|
|
+ 'mapreduce.reduce.java.opts': '-Xmx1638m',
|
|
|
+ 'mapreduce.reduce.memory.mb': 2048,
|
|
|
+ 'yarn.app.mapreduce.am.command-opts': '-Xmx1638m',
|
|
|
+ 'yarn.app.mapreduce.am.resource.mb': 2048,
|
|
|
+ 'yarn.nodemanager.resource.memory-mb': 8192,
|
|
|
+ 'yarn.scheduler.maximum-allocation-mb': 8192,
|
|
|
+ 'yarn.scheduler.minimum-allocation-mb': 1024,
|
|
|
+ 'mapreduce.task.io.sort.mb': 410
|
|
|
}
|
|
|
}
|
|
|
];
|