Capacity.scheduler中的yarn.scheduler.minimum-allocation-mb和yarn.scheduler.minimum-allocation-vcores

时间:2015-08-05 06:35:24

标签: hadoop scheduler yarn

Hadoop的Capacity Scheduler有一点让我感到困惑。

从Hadoop源代码中,我发现yarn.scheduler.minimum-allocation-mbyarn.scheduler.minimum-allocation-vcores配置不能为CapacityScheduler才能生效。

private void validateConf(Configuration conf) {
// validate scheduler memory allocation setting
int minMem = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
int maxMem = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB);

if (minMem <= 0 || minMem > maxMem) {
  throw new YarnRuntimeException("Invalid resource scheduler memory"
    + " allocation configuration"
    + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB
    + "=" + minMem
    + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB
    + "=" + maxMem + ", min and max should be greater than 0"
    + ", max should be no smaller than min.");
}

// validate scheduler vcores allocation setting
int minVcores = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
int maxVcores = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES);

if (minVcores <= 0 || minVcores > maxVcores) {
  throw new YarnRuntimeException("Invalid resource scheduler vcores"
    + " allocation configuration"
    + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES
    + "=" + minVcores
    + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES
    + "=" + maxVcores + ", min and max should be greater than 0"
    + ", max should be no smaller than min.");
}

但在FairScheduler中,他们可以为0。

private void validateConf(Configuration conf) {
// validate scheduler memory allocation setting
int minMem = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
int maxMem = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB);

if (minMem < 0 || minMem > maxMem) {
  throw new YarnRuntimeException("Invalid resource scheduler memory"
    + " allocation configuration"
    + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB
    + "=" + minMem
    + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB
    + "=" + maxMem + ", min should equal greater than 0"
    + ", max should be no smaller than min.");
}

// validate scheduler vcores allocation setting
int minVcores = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
int maxVcores = conf.getInt(
  YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
  YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES);

if (minVcores < 0 || minVcores > maxVcores) {
  throw new YarnRuntimeException("Invalid resource scheduler vcores"
    + " allocation configuration"
    + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES
    + "=" + minVcores
    + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES
    + "=" + maxVcores + ", min should equal greater than 0"
    + ", max should be no smaller than min.");
}

0 个答案:

没有答案