gpt4 book ai didi

org.apache.hadoop.yarn.conf.YarnConfiguration.getStringCollection()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 01:04:40 28 4
gpt4 key购买 nike

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

YarnConfiguration.getStringCollection介绍

暂无

代码示例

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

public static List<String> getRMHAWebappAddresses(
   final YarnConfiguration conf) {
  Collection<String> rmIds =
    conf.getStringCollection(YarnConfiguration.RM_HA_IDS);
  List<String> addrs = new ArrayList<String>();
  if (YarnConfiguration.useHttps(conf)) {
   for (String id : rmIds) {
    String addr = conf.get(
      YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + "." + id);
    if (addr != null) {
     addrs.add(addr);
    }
   }
  } else {
   for (String id : rmIds) {
    String addr = conf.get(YarnConfiguration.RM_WEBAPP_ADDRESS + "." + id);
    if (addr != null) {
     addrs.add(addr);
    }
   }
  }
  return addrs;
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-common

public static List<String> getRMHAWebappAddresses(
   final YarnConfiguration conf) {
  Collection<String> rmIds =
    conf.getStringCollection(YarnConfiguration.RM_HA_IDS);
  List<String> addrs = new ArrayList<String>();
  if (YarnConfiguration.useHttps(conf)) {
   for (String id : rmIds) {
    String addr = conf.get(
      YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + "." + id);
    if (addr != null) {
     addrs.add(addr);
    }
   }
  } else {
   for (String id : rmIds) {
    String addr = conf.get(YarnConfiguration.RM_WEBAPP_ADDRESS + "." + id);
    if (addr != null) {
     addrs.add(addr);
    }
   }
  }
  return addrs;
 }
}

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

public static List<String> getRMHAWebappAddresses(
   final YarnConfiguration conf) {
  String prefix;
  String defaultPort;
  if (YarnConfiguration.useHttps(conf)) {
   prefix = YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS;
   defaultPort = ":" + YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT;
  } else {
   prefix =YarnConfiguration.RM_WEBAPP_ADDRESS;
   defaultPort = ":" + YarnConfiguration.DEFAULT_RM_WEBAPP_PORT;
  }
  Collection<String> rmIds =
    conf.getStringCollection(YarnConfiguration.RM_HA_IDS);
  List<String> addrs = new ArrayList<String>();
  for (String id : rmIds) {
   String addr = conf.get(HAUtil.addSuffix(prefix, id));
   if (addr == null) {
    String hostname =
      conf.get(HAUtil.addSuffix(YarnConfiguration.RM_HOSTNAME, id));
    if (hostname != null) {
     addr = hostname + defaultPort;
    }
   }
   if (addr != null) {
    addrs.add(addr);
   }
  }
  return addrs;
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

public static String findActiveRMHAId(YarnConfiguration conf) {
 YarnConfiguration yarnConf = new YarnConfiguration(conf);
 Collection<String> rmIds =
   yarnConf.getStringCollection(YarnConfiguration.RM_HA_IDS);
 for (String currentId : rmIds) {
  yarnConf.set(YarnConfiguration.RM_HA_ID, currentId);
  try {
   HAServiceState haState = getHAState(yarnConf);
   if (haState.equals(HAServiceState.ACTIVE)) {
    return currentId;
   }
  } catch (Exception e) {
   // Couldn't check if this RM is active. Do nothing. Worst case,
   // we wouldn't find an Active RM and return null.
  }
 }
 return null; // Couldn't find an Active RM
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-common

public static String findActiveRMHAId(YarnConfiguration conf) {
 YarnConfiguration yarnConf = new YarnConfiguration(conf);
 Collection<String> rmIds =
   yarnConf.getStringCollection(YarnConfiguration.RM_HA_IDS);
 for (String currentId : rmIds) {
  yarnConf.set(YarnConfiguration.RM_HA_ID, currentId);
  try {
   HAServiceState haState = getHAState(yarnConf);
   if (haState.equals(HAServiceState.ACTIVE)) {
    return currentId;
   }
  } catch (Exception e) {
   // Couldn't check if this RM is active. Do nothing. Worst case,
   // we wouldn't find an Active RM and return null.
  }
 }
 return null; // Couldn't find an Active RM
}

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

public static String findActiveRMHAId(YarnConfiguration conf) {
 YarnConfiguration yarnConf = new YarnConfiguration(conf);
 Collection<String> rmIds =
   yarnConf.getStringCollection(YarnConfiguration.RM_HA_IDS);
 for (String currentId : rmIds) {
  yarnConf.set(YarnConfiguration.RM_HA_ID, currentId);
  try {
   HAServiceState haState = getHAState(yarnConf);
   if (haState.equals(HAServiceState.ACTIVE)) {
    return currentId;
   }
  } catch (Exception e) {
   // Couldn't check if this RM is active. Do nothing. Worst case,
   // we wouldn't find an Active RM and return null.
  }
 }
 return null; // Couldn't find an Active RM
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com