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


Java ResourceManagerAdministrationProtocol类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol的典型用法代码示例。如果您正苦于以下问题:Java ResourceManagerAdministrationProtocol类的具体用法?Java ResourceManagerAdministrationProtocol怎么用?Java ResourceManagerAdministrationProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourceManagerAdministrationProtocol类属于org.apache.hadoop.yarn.server.api包,在下文中一共展示了ResourceManagerAdministrationProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRMAddress

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
@Private
@Override
protected InetSocketAddress getRMAddress(YarnConfiguration conf,
    Class<?> protocol) throws IOException {
  if (protocol == ApplicationClientProtocol.class) {
    return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_PORT);
  } else if (protocol == ResourceManagerAdministrationProtocol.class) {
    return conf.getSocketAddr(
        YarnConfiguration.RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_PORT);
  } else if (protocol == ApplicationMasterProtocol.class) {
    setAMRMTokenService(conf);
    return conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
        YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
        YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
  } else {
    String message = "Unsupported protocol found when creating the proxy " +
        "connection to ResourceManager: " +
        ((protocol != null) ? protocol.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:ClientRMProxy.java

示例2: getGroups

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int getGroups(String[] usernames) throws IOException {
  // Get groups users belongs to
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();

  if (usernames.length == 0) {
    usernames = new String[] { UserGroupInformation.getCurrentUser().getUserName() };
  }
  
  for (String username : usernames) {
    StringBuilder sb = new StringBuilder();
    sb.append(username + " :");
    for (String group : adminProtocol.getGroupsForUser(username)) {
      sb.append(" ");
      sb.append(group);
    }
    System.out.println(sb);
  }
  
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:RMAdminCLI.java

示例3: removeFromClusterNodeLabels

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int removeFromClusterNodeLabels(String args) throws IOException,
    YarnException {
  Set<String> labels = buildNodeLabelsSetFromStr(args);

  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).removeFromClusterNodeLabels(
        labels);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    RemoveFromClusterNodeLabelsRequest request =
        RemoveFromClusterNodeLabelsRequest.newInstance(labels);
    adminProtocol.removeFromClusterNodeLabels(request);
  }

  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:RMAdminCLI.java

示例4: updateNodeResource

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int updateNodeResource(String nodeIdStr, int memSize,
    int cores, int overCommitTimeout) throws IOException, YarnException {
  // check resource value first
  if (invalidResourceValue(memSize, cores)) {
    throw new IllegalArgumentException("Invalid resource value: " + "(" +
        memSize + "," + cores + ") for updateNodeResource.");
  }
  // Refresh the nodes
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
  UpdateNodeResourceRequest request =
    recordFactory.newRecordInstance(UpdateNodeResourceRequest.class);
  NodeId nodeId = ConverterUtils.toNodeId(nodeIdStr);
  
  Resource resource = Resources.createResource(memSize, cores);
  Map<NodeId, ResourceOption> resourceMap =
      new HashMap<NodeId, ResourceOption>();
  resourceMap.put(
      nodeId, ResourceOption.newInstance(resource, overCommitTimeout));
  request.setNodeResourceMap(resourceMap);
  adminProtocol.updateNodeResource(request);
  return 0;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:23,代码来源:RMAdminCLI.java

示例5: removeFromClusterNodeLabels

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int removeFromClusterNodeLabels(String args) throws IOException,
    YarnException {
  Set<String> labels = buildNodeLabelNamesFromStr(args);

  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).removeFromClusterNodeLabels(
        labels);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    RemoveFromClusterNodeLabelsRequest request =
        RemoveFromClusterNodeLabelsRequest.newInstance(labels);
    adminProtocol.removeFromClusterNodeLabels(request);
  }

  return 0;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:RMAdminCLI.java

示例6: removeFromClusterNodeLabels

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int removeFromClusterNodeLabels(String args) throws IOException,
    YarnException {
  Set<String> labels = new HashSet<String>();
  for (String p : args.split(",")) {
    labels.add(p);
  }

  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).removeFromClusterNodeLabels(
        labels);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    RemoveFromClusterNodeLabelsRequest request =
        RemoveFromClusterNodeLabelsRequest.newInstance(labels);
    adminProtocol.removeFromClusterNodeLabels(request);
  }

  return 0;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:RMAdminCLI.java

示例7: serviceStart

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
    rpc.getServer(ResourceManagerAdministrationProtocol.class, this, masterServiceAddress,
        conf, null,
        conf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT, 
            YarnConfiguration.DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    refreshServiceAcls(conf, new RMPolicyProvider());
  }

  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_ADMIN_ADDRESS,
                         server.getListenerAddress());
  super.serviceStart();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:23,代码来源:AdminService.java

示例8: getRMAddress

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private static InetSocketAddress getRMAddress(Configuration conf,
    Class<?> protocol) throws IOException {
  if (protocol == ApplicationClientProtocol.class) {
    return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_PORT);
  } else if (protocol == ResourceManagerAdministrationProtocol.class) {
    return conf.getSocketAddr(
        YarnConfiguration.RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_PORT);
  } else if (protocol == ApplicationMasterProtocol.class) {
    InetSocketAddress serviceAddr =
        conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
          YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
          YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
    setupTokens(serviceAddr);
    return serviceAddr;
  } else {
    String message = "Unsupported protocol found when creating the proxy " +
        "connection to ResourceManager: " +
        ((protocol != null) ? protocol.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:27,代码来源:ClientRMProxy.java

示例9: updateNodeResource

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int updateNodeResource(String nodeIdStr, int memSize,
    int cores, int overCommitTimeout) throws IOException, YarnException {
  // check resource value first
  if (invalidResourceValue(memSize, cores)) {
    throw new IllegalArgumentException("Invalid resource value: " + "(" +
        memSize + "," + cores + ") for updateNodeResource.");
  }
  // Refresh the nodes
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
  UpdateNodeResourceRequest request =
    recordFactory.newRecordInstance(UpdateNodeResourceRequest.class);
  NodeId nodeId = NodeId.fromString(nodeIdStr);
  
  Resource resource = Resources.createResource(memSize, cores);
  Map<NodeId, ResourceOption> resourceMap =
      new HashMap<NodeId, ResourceOption>();
  resourceMap.put(
      nodeId, ResourceOption.newInstance(resource, overCommitTimeout));
  request.setNodeResourceMap(resourceMap);
  adminProtocol.updateNodeResource(request);
  return 0;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:RMAdminCLI.java

示例10: startServer

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
protected void startServer() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server = (Server) rpc.getServer(
      ResourceManagerAdministrationProtocol.class, this, masterServiceBindAddress,
      conf, null,
      conf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT,
          YarnConfiguration.DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
      false)) {
    refreshServiceAcls(
        getConfiguration(conf,
            YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE),
        RMPolicyProvider.getInstance());
  }

  if (rmContext.isHAEnabled()) {
    RPC.setProtocolEngine(conf, HAServiceProtocolPB.class,
        ProtobufRpcEngine.class);

    HAServiceProtocolServerSideTranslatorPB haServiceProtocolXlator =
        new HAServiceProtocolServerSideTranslatorPB(this);
    BlockingService haPbService =
        HAServiceProtocolProtos.HAServiceProtocolService
            .newReflectiveBlockingService(haServiceProtocolXlator);
    server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
        HAServiceProtocol.class, haPbService);
  }

  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
                         YarnConfiguration.RM_ADMIN_ADDRESS,
                         YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
                         server.getListenerAddress());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:39,代码来源:AdminService.java

示例11: createAdminProtocol

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
protected ResourceManagerAdministrationProtocol createAdminProtocol()
    throws IOException {
  // Get the current configuration
  final YarnConfiguration conf = new YarnConfiguration(getConf());
  return ClientRMProxy.createRMProxy(conf,
      ResourceManagerAdministrationProtocol.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:RMAdminCLI.java

示例12: refreshQueues

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int refreshQueues() throws IOException, YarnException {
  // Refresh the queue properties
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
  RefreshQueuesRequest request = 
    recordFactory.newRecordInstance(RefreshQueuesRequest.class);
  adminProtocol.refreshQueues(request);
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:RMAdminCLI.java

示例13: refreshNodes

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int refreshNodes() throws IOException, YarnException {
  // Refresh the nodes
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
  RefreshNodesRequest request = 
    recordFactory.newRecordInstance(RefreshNodesRequest.class);
  adminProtocol.refreshNodes(request);
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:RMAdminCLI.java

示例14: refreshUserToGroupsMappings

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int refreshUserToGroupsMappings() throws IOException,
    YarnException {
  // Refresh the user-to-groups mappings
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
  RefreshUserToGroupsMappingsRequest request = 
    recordFactory.newRecordInstance(RefreshUserToGroupsMappingsRequest.class);
  adminProtocol.refreshUserToGroupsMappings(request);
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RMAdminCLI.java

示例15: refreshSuperUserGroupsConfiguration

import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol; //导入依赖的package包/类
private int refreshSuperUserGroupsConfiguration() throws IOException,
    YarnException {
  // Refresh the super-user groups
  ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
  RefreshSuperUserGroupsConfigurationRequest request = 
    recordFactory.newRecordInstance(RefreshSuperUserGroupsConfigurationRequest.class);
  adminProtocol.refreshSuperUserGroupsConfiguration(request);
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RMAdminCLI.java


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