// Use TT_RESOURCE_CALCULATOR_PLUGIN if it is configured.
Class<? extends MemoryCalculatorPlugin> clazz =
fConf.getClass(MAPRED_TASKTRACKER_MEMORY_CALCULATOR_PLUGIN_PROPERTY,
null, MemoryCalculatorPlugin.class);
MemoryCalculatorPlugin memoryCalculatorPlugin =
(clazz == null
? null
: MemoryCalculatorPlugin.getMemoryCalculatorPlugin(clazz, fConf));
if (memoryCalculatorPlugin != null || resourceCalculatorPlugin != null) {
totalVirtualMemoryOnTT =
(memoryCalculatorPlugin == null
? resourceCalculatorPlugin.getVirtualMemorySize()
: memoryCalculatorPlugin.getVirtualMemorySize());
if (totalVirtualMemoryOnTT <= 0) {
LOG.warn("TaskTracker's totalVmem could not be calculated. "
+ "Setting it to " + JobConf.DISABLED_MEMORY_LIMIT);
totalVirtualMemoryOnTT = JobConf.DISABLED_MEMORY_LIMIT;
}
totalPhysicalMemoryOnTT =
(memoryCalculatorPlugin == null
? resourceCalculatorPlugin.getPhysicalMemorySize()
: memoryCalculatorPlugin.getPhysicalMemorySize());
if (totalPhysicalMemoryOnTT <= 0) {
LOG.warn("TaskTracker's totalPmem could not be calculated. "
+ "Setting it to " + JobConf.DISABLED_MEMORY_LIMIT);
totalPhysicalMemoryOnTT = JobConf.DISABLED_MEMORY_LIMIT;
}