当前位置: 首页>>代码示例>>Java>>正文


Java Apps.setEnvFromInputString方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.util.Apps.setEnvFromInputString方法的典型用法代码示例。如果您正苦于以下问题:Java Apps.setEnvFromInputString方法的具体用法?Java Apps.setEnvFromInputString怎么用?Java Apps.setEnvFromInputString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.util.Apps的用法示例。


在下文中一共展示了Apps.setEnvFromInputString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setVMEnv

import org.apache.hadoop.yarn.util.Apps; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void setVMEnv(Map<String, String> environment, Configuration conf) {
  // Add the env variables passed by the user
  String setEnv = getChildEnv(conf);
  Apps.setEnvFromInputString(environment, setEnv);

  // Set logging level in the environment.
  // This is so that, if the child forks another "bin/hadoop" (common in
  // streaming) it will have the correct loglevel.
  environment.put("HADOOP_ROOT_LOGGER", getChildLogLevel(conf) + ",CLA");

  String hadoopClientOpts = System.getenv("HADOOP_CLIENT_OPTS");
  if (hadoopClientOpts == null) {
    hadoopClientOpts = "";
  } else {
    hadoopClientOpts = hadoopClientOpts + " ";
  }

  long logSize = 0;
  Vector<String> logProps = new Vector<String>(4);
  setupLog4jProperties(conf, logProps, logSize);
  Iterator<String> it = logProps.iterator();
  StringBuilder buffer = new StringBuilder();
  while (it.hasNext()) {
    buffer.append(" ").append(it.next());
  }
  hadoopClientOpts = hadoopClientOpts + buffer.toString();
  environment.put("HADOOP_CLIENT_OPTS", hadoopClientOpts);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:30,代码来源:PSAgentAttemptJVM.java

示例2: setVMEnv

import org.apache.hadoop.yarn.util.Apps; //导入方法依赖的package包/类
/**
 * Set environment variables of worker attempt process
 * @param environment environment variables of ps attempt process
 * @param conf application configuration
 */
public static void setVMEnv(Map<String, String> environment, Configuration conf) {
  // Add the env variables passed by the user
  String workerChildEnv = getChildEnv(conf);
  LOG.info("worker env=" + workerChildEnv);
  try{
    Apps.setEnvFromInputString(environment, workerChildEnv);
  } catch (Exception x) {
    LOG.error("set worker env failed.",  x);
  }
  
  // Set logging level in the environment.
  environment.put("HADOOP_ROOT_LOGGER", getChildLogLevel(conf) + ",CLA");

  String hadoopClientOpts = System.getenv("HADOOP_CLIENT_OPTS");
  if (hadoopClientOpts == null) {
    hadoopClientOpts = "";
  } else {
    hadoopClientOpts = hadoopClientOpts + " ";
  }

  long logSize = 0;
  Vector<String> logProps = new Vector<String>(4);
  setupLog4jProperties(conf, logProps, logSize);
  Iterator<String> it = logProps.iterator();
  StringBuilder buffer = new StringBuilder();
  while (it.hasNext()) {
    buffer.append(" ").append(it.next());
  }
  hadoopClientOpts = hadoopClientOpts + buffer.toString();
  environment.put("HADOOP_CLIENT_OPTS", hadoopClientOpts);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:37,代码来源:WorkerJVM.java

示例3: setVMEnv

import org.apache.hadoop.yarn.util.Apps; //导入方法依赖的package包/类
/**
 * Set environment variables of ps attempt process
 * @param environment environment variables of ps attempt process
 * @param conf application configuration
 */
public static void setVMEnv(Map<String, String> environment, Configuration conf) {
  // Add the env variables passed by the user
  String setEnv = getChildEnv(conf);
  try{
    Apps.setEnvFromInputString(environment, setEnv);
  } catch (Exception x) {
    LOG.error("set ps env faile.", x);
  }    

  // Set logging level in the environment.
  environment.put("HADOOP_ROOT_LOGGER", getChildLogLevel(conf) + ",CLA");

  String hadoopClientOpts = System.getenv("HADOOP_CLIENT_OPTS");
  if (hadoopClientOpts == null) {
    hadoopClientOpts = "";
  } else {
    hadoopClientOpts = hadoopClientOpts + " ";
  }

  long logSize = 0;
  Vector<String> logProps = new Vector<String>(4);
  setupLog4jProperties(conf, logProps, logSize);
  Iterator<String> it = logProps.iterator();
  StringBuilder buffer = new StringBuilder();
  while (it.hasNext()) {
    buffer.append(" ").append(it.next());
  }
  hadoopClientOpts = hadoopClientOpts + buffer.toString();
  environment.put("HADOOP_CLIENT_OPTS", hadoopClientOpts);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:36,代码来源:ParameterServerJVM.java

示例4: setEnvFromInputString

import org.apache.hadoop.yarn.util.Apps; //导入方法依赖的package包/类
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,代码行数:9,代码来源:MRApps.java

示例5: setVMEnv

import org.apache.hadoop.yarn.util.Apps; //导入方法依赖的package包/类
public static void setVMEnv(Map<String, String> environment,
    Task task) {

  JobConf conf = task.conf;

  // Add the env variables passed by the user
  String mapredChildEnv = getChildEnv(conf, task.isMapTask());
  Apps.setEnvFromInputString(environment, mapredChildEnv);

  // Set logging level in the environment.
  // This is so that, if the child forks another "bin/hadoop" (common in
  // streaming) it will have the correct loglevel.
  environment.put(
      "HADOOP_ROOT_LOGGER", 
      getChildLogLevel(conf, task.isMapTask()) + ",CLA"); 

  // TODO: The following is useful for instance in streaming tasks. Should be
  // set in ApplicationMaster's env by the RM.
  String hadoopClientOpts = System.getenv("HADOOP_CLIENT_OPTS");
  if (hadoopClientOpts == null) {
    hadoopClientOpts = "";
  } else {
    hadoopClientOpts = hadoopClientOpts + " ";
  }
  // FIXME: don't think this is also needed given we already set java
  // properties.
  long logSize = TaskLog.getTaskLogLength(conf);
  Vector<String> logProps = new Vector<String>(4);
  setupLog4jProperties(task, logProps, logSize);
  Iterator<String> it = logProps.iterator();
  StringBuffer buffer = new StringBuffer();
  while (it.hasNext()) {
    buffer.append(" " + it.next());
  }
  hadoopClientOpts = hadoopClientOpts + buffer.toString();
  environment.put("HADOOP_CLIENT_OPTS", hadoopClientOpts);

  // Add stdout/stderr env
  environment.put(
      MRJobConfig.STDOUT_LOGFILE_ENV,
      getTaskLogFile(TaskLog.LogName.STDOUT)
      );
  environment.put(
      MRJobConfig.STDERR_LOGFILE_ENV,
      getTaskLogFile(TaskLog.LogName.STDERR)
      );
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:48,代码来源:MapReduceChildJVM.java


注:本文中的org.apache.hadoop.yarn.util.Apps.setEnvFromInputString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。