gpt4 book ai didi

org.apache.hadoop.yarn.client.util.YarnClientUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 16:03:31 29 4
gpt4 key购买 nike

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

YarnClientUtils介绍

[英]This class is a container for utility methods that are useful when creating YARN clients.
[中]这个类是创建客户机时有用的实用方法的容器。

代码示例

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

/**
 * Look up and return the resource manager's principal. This method
 * automatically does the <code>_HOST</code> replacement in the principal and
 * correctly handles HA resource manager configurations.
 *
 * @param conf the {@link Configuration} file from which to read the
 * principal
 * @return the resource manager's principal string or null if the
 * {@link YarnConfiguration#RM_PRINCIPAL} property is not set in the
 * {@code conf} parameter
 * @throws IOException thrown if there's an error replacing the host name
 */
public static String getRmPrincipal(Configuration conf) throws IOException {
 String principal = conf.get(YarnConfiguration.RM_PRINCIPAL);
 String prepared = null;
 if (principal != null) {
  prepared = getRmPrincipal(principal, conf);
 }
 return prepared;
}

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

/**
 * Perform the <code>_HOST</code> replacement in the {@code principal},
 * Returning the result. Correctly handles HA resource manager configurations.
 *
 * @param rmPrincipal the principal string to prepare
 * @param conf the configuration
 * @return the prepared principal string
 * @throws IOException thrown if there's an error replacing the host name
 */
public static String getRmPrincipal(String rmPrincipal, Configuration conf)
  throws IOException {
 if (rmPrincipal == null) {
  throw new IllegalArgumentException("RM principal string is null");
 }
 if (HAUtil.isHAEnabled(conf)) {
  conf = getYarnConfWithRmHaId(conf);
 }
 String hostname = conf.getSocketAddr(
   YarnConfiguration.RM_ADDRESS,
   YarnConfiguration.DEFAULT_RM_ADDRESS,
   YarnConfiguration.DEFAULT_RM_PORT).getHostName();
 return SecurityUtil.getServerPrincipal(rmPrincipal, hostname);
}

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

private int handleAddToClusterNodeLabels(String[] args, String cmd,
  boolean isHAEnabled) throws IOException, YarnException, ParseException {
 Options opts = new Options();
 opts.addOption("addToClusterNodeLabels", true,
   "Add to cluster node labels.");
 opts.addOption("directlyAccessNodeLabelStore", false,
   "Directly access node label store.");
 int exitCode = -1;
 CommandLine cliParser = null;
 try {
  cliParser = new GnuParser().parse(opts, args);
 } catch (MissingArgumentException ex) {
  System.err.println(NO_LABEL_ERR_MSG);
  printUsage(args[0], isHAEnabled);
  return exitCode;
 }
 List<NodeLabel> labels = YarnClientUtils.buildNodeLabelsFromStr(
   cliParser.getOptionValue("addToClusterNodeLabels"));
 if (cliParser.hasOption("directlyAccessNodeLabelStore")) {
  getNodeLabelManagerInstance(getConf()).addToCluserNodeLabels(labels);
 } else {
  ResourceManagerAdministrationProtocol adminProtocol =
    createAdminProtocol();
  AddToClusterNodeLabelsRequest request =
    AddToClusterNodeLabelsRequest.newInstance(labels);
  adminProtocol.addToClusterNodeLabels(request);
 }
 return 0;
}

代码示例来源:origin: linkedin/TonY

String tokenRenewer = YarnClientUtils.getRmPrincipal(yarnConf);
if (tokenRenewer == null) {
 throw new RuntimeException("Failed to get RM principal.");

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

String tokenRenewer = YarnClientUtils.getRmPrincipal(conf);
if (tokenRenewer == null || tokenRenewer.length() == 0) {
 throw new IOException(

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