gpt4 book ai didi

org.apache.twill.internal.yarn.YarnUtils.getRMAddress()方法的使用及代码示例

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

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

YarnUtils.getRMAddress介绍

暂无

代码示例

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

public static String getYarnTokenRenewer(Configuration config) throws IOException {
 String rmHost = getRMAddress(config).getHostName();
 String renewer = SecurityUtil.getServerPrincipal(config.get(YarnConfiguration.RM_PRINCIPAL), rmHost);
 if (renewer == null || renewer.length() == 0) {
  throw new IOException("No Kerberos principal for Yarn RM to use as renewer");
 }
 return renewer;
}

代码示例来源:origin: apache/twill

public static String getYarnTokenRenewer(Configuration config) throws IOException {
 String rmHost = getRMAddress(config).getHostName();
 String renewer = SecurityUtil.getServerPrincipal(config.get(YarnConfiguration.RM_PRINCIPAL), rmHost);
 if (renewer == null || renewer.length() == 0) {
  throw new IOException("No Kerberos principal for Yarn RM to use as renewer");
 }
 return renewer;
}

代码示例来源:origin: caskdata/cdap

services.add(SecurityUtil.buildTokenService(YarnUtils.getRMAddress(configuration)).toString());

代码示例来源:origin: co.cask.cdap/cdap-common

services.add(SecurityUtil.buildTokenService(YarnUtils.getRMAddress(configuration)).toString());

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

services.add(SecurityUtil.buildTokenService(YarnUtils.getRMAddress(configuration)).toString());

代码示例来源:origin: apache/twill

services.add(SecurityUtil.buildTokenService(YarnUtils.getRMAddress(configuration)).toString());

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

private void addRMToken(ContainerLaunchContext context, YarnClient yarnClient) {
 if (!UserGroupInformation.isSecurityEnabled()) {
  return;
 }
 try {
  Credentials credentials = YarnUtils.decodeCredentials(context.getContainerTokens());
  Configuration config = yarnClient.getConfig();
  Token<TokenIdentifier> token = convertToken(
   yarnClient.getRMDelegationToken(new Text(YarnUtils.getYarnTokenRenewer(config))),
   YarnUtils.getRMAddress(config));
  LOG.debug("Added RM delegation token {}", token);
  credentials.addToken(token.getService(), token);
  context.setContainerTokens(YarnUtils.encodeCredentials(credentials));
 } catch (IOException e) {
  throw new RuntimeException("Failed to acquire RM delegation token", e);
 }
}

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

/**
 * Adds RM delegation token to the given {@link ContainerLaunchContext} so that the AM can authenticate itself
 * with RM using the delegation token.
 */
protected void addRMToken(ContainerLaunchContext context, YarnClient yarnClient, ApplicationId appId) {
 if (!UserGroupInformation.isSecurityEnabled()) {
  return;
 }
 try {
  Credentials credentials = YarnUtils.decodeCredentials(context.getTokens());
  Configuration config = yarnClient.getConfig();
  Token<TokenIdentifier> token = ConverterUtils.convertFromYarn(
   yarnClient.getRMDelegationToken(new Text(YarnUtils.getYarnTokenRenewer(config))),
   YarnUtils.getRMAddress(config));
  LOG.debug("Added RM delegation token {} for application {}", token, appId);
  credentials.addToken(token.getService(), token);
  context.setTokens(YarnUtils.encodeCredentials(credentials));
 } catch (YarnException | IOException e) {
  throw new RuntimeException("Failed to acquire RM delegation token", e);
 }
}

代码示例来源:origin: apache/twill

/**
 * Adds RM delegation token to the given {@link ContainerLaunchContext} so that the AM can authenticate itself
 * with RM using the delegation token.
 */
protected void addRMToken(ContainerLaunchContext context, YarnClient yarnClient, ApplicationId appId) {
 if (!UserGroupInformation.isSecurityEnabled()) {
  return;
 }
 try {
  Credentials credentials = YarnUtils.decodeCredentials(context.getTokens());
  Configuration config = yarnClient.getConfig();
  Token<TokenIdentifier> token = ConverterUtils.convertFromYarn(
   yarnClient.getRMDelegationToken(new Text(YarnUtils.getYarnTokenRenewer(config))),
   YarnUtils.getRMAddress(config));
  LOG.debug("Added RM delegation token {} for application {}", token, appId);
  credentials.addToken(token.getService(), token);
  context.setTokens(YarnUtils.encodeCredentials(credentials));
 } catch (YarnException | IOException e) {
  throw new RuntimeException("Failed to acquire RM delegation token", e);
 }
}

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