/** * Test that verifies default values are configured and reported correctly. * * @throws Exception */ public void testDefaultResourceValues() throws Exception { JobConf conf = new JobConf(); try { // Memory values are disabled by default. conf.setClass( org.apache.hadoop.mapred.TaskTracker.TT_RESOURCE_CALCULATOR_PLUGIN, DummyResourceCalculatorPlugin.class, ResourceCalculatorPlugin.class); setUpCluster(conf); JobConf jobConf = miniMRCluster.createJobConf(); jobConf.setClass( org.apache.hadoop.mapred.TaskTracker.TT_RESOURCE_CALCULATOR_PLUGIN, DummyResourceCalculatorPlugin.class, ResourceCalculatorPlugin.class); runSleepJob(jobConf); verifyTestResults(); } finally { tearDownCluster(); } }
/** * Test that verifies that configured values are reported correctly. * * @throws Exception */ public void testConfiguredResourceValues() throws Exception { JobConf conf = new JobConf(); conf.setLong("totalVmemOnTT", 4 * 1024 * 1024 * 1024L); conf.setLong("totalPmemOnTT", 2 * 1024 * 1024 * 1024L); conf.setLong("mapSlotMemorySize", 1 * 512L); conf.setLong("reduceSlotMemorySize", 1 * 1024L); conf.setLong("availableVmemOnTT", 4 * 1024 * 1024 * 1024L); conf.setLong("availablePmemOnTT", 2 * 1024 * 1024 * 1024L); conf.setLong("cumulativeCpuTime", 10000L); conf.setLong("cpuFrequency", 2000000L); conf.setInt("numProcessors", 8); conf.setFloat("cpuUsage", 15.5F); conf.setLong("procCumulativeCpuTime", 1000L); conf.setLong("procVirtualMemorySize", 2 * 1024 * 1024 * 1024L); conf.setLong("procPhysicalMemorySize", 1024 * 1024 * 1024L); conf.setClass( org.apache.hadoop.mapred.TaskTracker.TT_RESOURCE_CALCULATOR_PLUGIN, DummyResourceCalculatorPlugin.class, ResourceCalculatorPlugin.class); conf.setLong(DummyResourceCalculatorPlugin.MAXVMEM_TESTING_PROPERTY, 4 * 1024 * 1024 * 1024L); conf.setLong(DummyResourceCalculatorPlugin.MAXPMEM_TESTING_PROPERTY, 2 * 1024 * 1024 * 1024L); conf.setLong(JobTracker.MAPRED_CLUSTER_MAP_MEMORY_MB_PROPERTY, 512L); conf.setLong(JobTracker.MAPRED_CLUSTER_REDUCE_MEMORY_MB_PROPERTY, 1024L); conf.setLong(DummyResourceCalculatorPlugin.CUMULATIVE_CPU_TIME, 10000L); conf.setLong(DummyResourceCalculatorPlugin.CPU_FREQUENCY, 2000000L); conf.setInt(DummyResourceCalculatorPlugin.NUM_PROCESSORS, 8); conf.setFloat(DummyResourceCalculatorPlugin.CPU_USAGE, 15.5F); try { setUpCluster(conf); JobConf jobConf = miniMRCluster.createJobConf(); jobConf.setMemoryForMapTask(1 * 1024L); jobConf.setMemoryForReduceTask(2 * 1024L); jobConf.setClass( org.apache.hadoop.mapred.TaskTracker.TT_RESOURCE_CALCULATOR_PLUGIN, DummyResourceCalculatorPlugin.class, ResourceCalculatorPlugin.class); jobConf.setLong(DummyResourceCalculatorPlugin.PROC_CUMULATIVE_CPU_TIME, 1000L); jobConf.setLong(DummyResourceCalculatorPlugin.PROC_VMEM_TESTING_PROPERTY, 2 * 1024 * 1024 * 1024L); jobConf.setLong(DummyResourceCalculatorPlugin.PROC_PMEM_TESTING_PROPERTY, 1024 * 1024 * 1024L); runSleepJob(jobConf); verifyTestResults(); } finally { tearDownCluster(); } }