org.apache.hadoop.util.Shell.checkIsBashSupported()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中org.apache.hadoop.util.Shell.checkIsBashSupported()方法的一些代码示例,展示了Shell.checkIsBashSupported()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.checkIsBashSupported()方法的具体详情如下:
包路径:org.apache.hadoop.util.Shell
类名称:Shell
方法名:checkIsBashSupported

Shell.checkIsBashSupported介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager

private void initAndStartNodeManager(Configuration conf, boolean hasToReboot) {
 try {
  // Failed to start if we're a Unix based system but we don't have bash.
  // Bash is necessary to launch containers under Unix-based systems.
  if (!Shell.WINDOWS) {
   if (!Shell.checkIsBashSupported()) {
    String message =
      "Failing NodeManager start since we're on a "
        + "Unix-based system but bash doesn't seem to be available.";
    LOG.error(message);
    throw new YarnRuntimeException(message);
   }
  }
  // Remove the old hook if we are rebooting.
  if (hasToReboot && null != nodeManagerShutdownHook) {
   ShutdownHookManager.get().removeShutdownHook(nodeManagerShutdownHook);
  }
  nodeManagerShutdownHook = new CompositeServiceShutdownHook(this);
  ShutdownHookManager.get().addShutdownHook(nodeManagerShutdownHook,
                       SHUTDOWN_HOOK_PRIORITY);
  // System exit should be called only when NodeManager is instantiated from
  // main() funtion
  this.shouldExitOnShutdownEvent = true;
  this.init(conf);
  this.start();
 } catch (Throwable t) {
  LOG.error("Error starting NodeManager", t);
  System.exit(-1);
 }
}

代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager

private void initAndStartNodeManager(Configuration conf, boolean hasToReboot) {
 try {
  // Failed to start if we're a Unix based system but we don't have bash.
  // Bash is necessary to launch containers under Unix-based systems.
  if (!Shell.WINDOWS) {
   if (!Shell.checkIsBashSupported()) {
    String message =
      "Failing NodeManager start since we're on a "
        + "Unix-based system but bash doesn't seem to be available.";
    LOG.fatal(message);
    throw new YarnRuntimeException(message);
   }
  }
  // Remove the old hook if we are rebooting.
  if (hasToReboot && null != nodeManagerShutdownHook) {
   ShutdownHookManager.get().removeShutdownHook(nodeManagerShutdownHook);
  }
  nodeManagerShutdownHook = new CompositeServiceShutdownHook(this);
  ShutdownHookManager.get().addShutdownHook(nodeManagerShutdownHook,
                       SHUTDOWN_HOOK_PRIORITY);
  // System exit should be called only when NodeManager is instantiated from
  // main() funtion
  this.shouldExitOnShutdownEvent = true;
  this.init(conf);
  this.start();
 } catch (Throwable t) {
  LOG.fatal("Error starting NodeManager", t);
  System.exit(-1);
 }
}

相关文章