当前位置: 首页>>代码示例>>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;未经允许,请勿转载。