當前位置: 首頁>>代碼示例>>Java>>正文


Java ApplicationConstants.CLASS_PATH_SEPARATOR屬性代碼示例

本文整理匯總了Java中org.apache.hadoop.yarn.api.ApplicationConstants.CLASS_PATH_SEPARATOR屬性的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationConstants.CLASS_PATH_SEPARATOR屬性的具體用法?Java ApplicationConstants.CLASS_PATH_SEPARATOR怎麽用?Java ApplicationConstants.CLASS_PATH_SEPARATOR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.hadoop.yarn.api.ApplicationConstants的用法示例。


在下文中一共展示了ApplicationConstants.CLASS_PATH_SEPARATOR屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testEnvExpansion

@Test(timeout = 10000)
public void testEnvExpansion() throws IOException {
  Path logPath = new Path("/nm/container/logs");
  String input =
      Apps.crossPlatformify("HADOOP_HOME") + "/share/hadoop/common/*"
          + ApplicationConstants.CLASS_PATH_SEPARATOR
          + Apps.crossPlatformify("HADOOP_HOME") + "/share/hadoop/common/lib/*"
          + ApplicationConstants.CLASS_PATH_SEPARATOR
          + Apps.crossPlatformify("HADOOP_LOG_HOME")
          + ApplicationConstants.LOG_DIR_EXPANSION_VAR;

  String res = ContainerLaunch.expandEnvironment(input, logPath);

  if (Shell.WINDOWS) {
    Assert.assertEquals("%HADOOP_HOME%/share/hadoop/common/*;"
        + "%HADOOP_HOME%/share/hadoop/common/lib/*;"
        + "%HADOOP_LOG_HOME%/nm/container/logs", res);
  } else {
    Assert.assertEquals("$HADOOP_HOME/share/hadoop/common/*:"
        + "$HADOOP_HOME/share/hadoop/common/lib/*:"
        + "$HADOOP_LOG_HOME/nm/container/logs", res);
  }
  System.out.println(res);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:TestContainerLaunch.java

示例2: testAMStandardEnv

@Test
public void testAMStandardEnv() throws Exception {
  final String ADMIN_LIB_PATH = "foo";
  final String USER_LIB_PATH = "bar";
  final String USER_SHELL = "shell";
  JobConf jobConf = new JobConf();

  jobConf.set(MRJobConfig.MR_AM_ADMIN_USER_ENV, "LD_LIBRARY_PATH=" +
      ADMIN_LIB_PATH);
  jobConf.set(MRJobConfig.MR_AM_ENV, "LD_LIBRARY_PATH="
      + USER_LIB_PATH);
  jobConf.set(MRJobConfig.MAPRED_ADMIN_USER_SHELL, USER_SHELL);

  YARNRunner yarnRunner = new YARNRunner(jobConf);
  ApplicationSubmissionContext appSubCtx =
      buildSubmitContext(yarnRunner, jobConf);

  // make sure PWD is first in the lib path
  ContainerLaunchContext clc = appSubCtx.getAMContainerSpec();
  Map<String, String> env = clc.getEnvironment();
  String libPath = env.get(Environment.LD_LIBRARY_PATH.name());
  assertNotNull("LD_LIBRARY_PATH not set", libPath);
  String cps = jobConf.getBoolean(
      MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM,
      MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM)
      ? ApplicationConstants.CLASS_PATH_SEPARATOR : File.pathSeparator;
  assertEquals("Bad AM LD_LIBRARY_PATH setting",
      MRApps.crossPlatformifyMREnv(conf, Environment.PWD)
      + cps + ADMIN_LIB_PATH + cps + USER_LIB_PATH, libPath);

  // make sure SHELL is set
  String shell = env.get(Environment.SHELL.name());
  assertNotNull("SHELL not set", shell);
  assertEquals("Bad SHELL setting", USER_SHELL, shell);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:35,代碼來源:TestYARNRunner.java

示例3: setEnvFromInputString

public static void setEnvFromInputString(Map<String, String> env,
    String envString, Configuration conf) {
  String classPathSeparator =
      conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM,
        MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM)
          ? ApplicationConstants.CLASS_PATH_SEPARATOR : File.pathSeparator;
  Apps.setEnvFromInputString(env, envString, classPathSeparator);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:8,代碼來源:MRApps.java

示例4: addToEnvironment

@Public
@Unstable
public static void addToEnvironment(Map<String, String> environment,
    String variable, String value, Configuration conf) {
  String classPathSeparator =
      conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM,
        MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM)
          ? ApplicationConstants.CLASS_PATH_SEPARATOR : File.pathSeparator;
  Apps.addToEnvironment(environment, variable, value, classPathSeparator);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:MRApps.java

示例5: addPathToEnvironment

private void addPathToEnvironment(Map<String, String> env, String key, String value) {
    String newValue = value;
    if (env.containsKey(key)) {
        newValue = env.get(key) + ApplicationConstants.CLASS_PATH_SEPARATOR  + value;
    }
    env.put(key, newValue);
}
 
開發者ID:splicemachine,項目名稱:spliceengine,代碼行數:7,代碼來源:OlapServerSubmitter.java

示例6: testAMStandardEnv

private void testAMStandardEnv(boolean customLibPath) throws Exception {
  // the Windows behavior is different and this test currently doesn't really
  // apply
  // MAPREDUCE-6588 should revisit this test
  if (Shell.WINDOWS) {
    return;
  }

  final String ADMIN_LIB_PATH = "foo";
  final String USER_LIB_PATH = "bar";
  final String USER_SHELL = "shell";
  JobConf jobConf = new JobConf();
  String pathKey = Environment.LD_LIBRARY_PATH.name();

  if (customLibPath) {
    jobConf.set(MRJobConfig.MR_AM_ADMIN_USER_ENV, pathKey + "=" +
        ADMIN_LIB_PATH);
    jobConf.set(MRJobConfig.MR_AM_ENV, pathKey + "=" + USER_LIB_PATH);
  }
  jobConf.set(MRJobConfig.MAPRED_ADMIN_USER_SHELL, USER_SHELL);

  YARNRunner yarnRunner = new YARNRunner(jobConf);
  ApplicationSubmissionContext appSubCtx =
      buildSubmitContext(yarnRunner, jobConf);

  // make sure PWD is first in the lib path
  ContainerLaunchContext clc = appSubCtx.getAMContainerSpec();
  Map<String, String> env = clc.getEnvironment();
  String libPath = env.get(pathKey);
  assertNotNull(pathKey + " not set", libPath);
  String cps = jobConf.getBoolean(
      MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM,
      MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM)
      ? ApplicationConstants.CLASS_PATH_SEPARATOR : File.pathSeparator;
  String expectedLibPath =
      MRApps.crossPlatformifyMREnv(conf, Environment.PWD);
  if (customLibPath) {
    // append admin libpath and user libpath
    expectedLibPath += cps + ADMIN_LIB_PATH + cps + USER_LIB_PATH;
  } else {
    expectedLibPath += cps +
        MRJobConfig.DEFAULT_MR_AM_ADMIN_USER_ENV.substring(
            pathKey.length() + 1);
  }
  assertEquals("Bad AM " + pathKey + " setting", expectedLibPath, libPath);

  // make sure SHELL is set
  String shell = env.get(Environment.SHELL.name());
  assertNotNull("SHELL not set", shell);
  assertEquals("Bad SHELL setting", USER_SHELL, shell);
}
 
開發者ID:hopshadoop,項目名稱:hops,代碼行數:51,代碼來源:TestYARNRunner.java


注:本文中的org.apache.hadoop.yarn.api.ApplicationConstants.CLASS_PATH_SEPARATOR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。