YARN-6372. Add default value for NM disk validator (Contributed by Yufei Gu via Daniel Templeton)

This commit is contained in:
Daniel Templeton 2017-04-10 14:55:22 -07:00
parent a5e57df3c5
commit e9ac61cc0e
4 changed files with 8 additions and 4 deletions

View File

@ -32,6 +32,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ha.ActiveStandbyElector; import org.apache.hadoop.ha.ActiveStandbyElector;
import org.apache.hadoop.http.HttpConfig; import org.apache.hadoop.http.HttpConfig;
import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.util.BasicDiskValidator;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.ApplicationConstants;
@ -974,7 +975,7 @@ public class YarnConfiguration extends Configuration {
/** Disk Validator. */ /** Disk Validator. */
public static final String DISK_VALIDATOR = NM_PREFIX + "disk-validator"; public static final String DISK_VALIDATOR = NM_PREFIX + "disk-validator";
public static final String DEFAULT_DISK_VALIDATOR = "basic"; public static final String DEFAULT_DISK_VALIDATOR = BasicDiskValidator.NAME;
/** /**
* Maximum size of contain's diagnostics to keep for relaunching container * Maximum size of contain's diagnostics to keep for relaunching container

View File

@ -181,7 +181,8 @@ public class DirectoryCollection {
conf = new YarnConfiguration(); conf = new YarnConfiguration();
try { try {
diskValidator = DiskValidatorFactory.getInstance( diskValidator = DiskValidatorFactory.getInstance(
conf.get(YarnConfiguration.DISK_VALIDATOR)); conf.get(YarnConfiguration.DISK_VALIDATOR,
YarnConfiguration.DEFAULT_DISK_VALIDATOR));
LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR + LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR +
" is loaded."); " is loaded.");
} catch (Exception e) { } catch (Exception e) {

View File

@ -127,7 +127,8 @@ public class ContainerLocalizer {
this.recordFactory = recordFactory; this.recordFactory = recordFactory;
this.conf = new YarnConfiguration(); this.conf = new YarnConfiguration();
this.diskValidator = DiskValidatorFactory.getInstance( this.diskValidator = DiskValidatorFactory.getInstance(
conf.get(YarnConfiguration.DISK_VALIDATOR)); conf.get(YarnConfiguration.DISK_VALIDATOR,
YarnConfiguration.DEFAULT_DISK_VALIDATOR));
LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR + LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR +
" is loaded."); " is loaded.");
this.appCacheDirContextName = String.format(APPCACHE_CTXT_FMT, appId); this.appCacheDirContextName = String.format(APPCACHE_CTXT_FMT, appId);

View File

@ -261,7 +261,8 @@ public class ResourceLocalizationService extends CompositeService
} }
diskValidator = DiskValidatorFactory.getInstance( diskValidator = DiskValidatorFactory.getInstance(
conf.get(YarnConfiguration.DISK_VALIDATOR)); conf.get(YarnConfiguration.DISK_VALIDATOR,
YarnConfiguration.DEFAULT_DISK_VALIDATOR));
LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR + LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR +
" is loaded."); " is loaded.");
cacheTargetSize = cacheTargetSize =