List of usage examples for org.apache.hadoop.yarn.conf YarnConfiguration getTrimmedStrings
public String[] getTrimmedStrings(String name)
name
property as an array of String
s, trimmed of the leading and trailing whitespace. From source file:org.apache.reef.runtime.yarn.YarnClasspathProvider.java
License:Apache License
@Inject YarnClasspathProvider(final YarnConfiguration yarnConfiguration) { boolean needsLegacyClasspath = false; // will be set to true below whenever we encounter issues with the YARN Configuration final ClassPathBuilder builder = new ClassPathBuilder(); try {//from ww w . j a va 2s . c o m // Add the classpath actually configured on this cluster final String[] yarnClassPath = yarnConfiguration .getTrimmedStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH); if (null == yarnClassPath || yarnClassPath.length == 0) { needsLegacyClasspath = true; } else { builder.addAll(yarnClassPath); } final String[] yarnDefaultClassPath = YarnConfiguration.DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH; if (null == yarnDefaultClassPath || yarnDefaultClassPath.length == 0) { LOG.log(Level.SEVERE, "YarnConfiguration.DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH is empty. This indicates a broken cluster configuration"); needsLegacyClasspath = true; } else { builder.addAll(yarnDefaultClassPath); } } catch (final NoSuchFieldError e) { // This means that one of the static fields above aren't actually in YarnConfiguration. // The reason for that is most likely that we encounter a really old version of YARN. needsLegacyClasspath = true; LOG.log(Level.SEVERE, YARN_TOO_OLD_MESSAGE); } if (needsLegacyClasspath) { builder.addAll(LEGACY_CLASSPATH_LIST); } this.classPathPrefix = builder.getPrefixAsImmutableList(); this.classPathSuffix = builder.getSuffixAsImmutableList(); this.logClasspath(); }