• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ReplaceLabelsOnNodeRequest类的典型用法和代码示例

java 2次浏览

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

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

示例1: replaceLabelsOnNode

点赞 3

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Override
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
    ReplaceLabelsOnNodeRequest request) throws YarnException, IOException {
  String argName = "replaceLabelsOnNode";
  final String msg = "set node to labels.";
  UserGroupInformation user = checkAcls(argName);

  checkRMStatus(user.getShortUserName(), argName, msg);

  ReplaceLabelsOnNodeResponse response =
      recordFactory.newRecordInstance(ReplaceLabelsOnNodeResponse.class);
  try {
    rmContext.getNodeLabelManager().replaceLabelsOnNode(
        request.getNodeToLabels());
    RMAuditLogger
        .logSuccess(user.getShortUserName(), argName, "AdminService");
    return response;
  } catch (IOException ioe) {
    throw logAndWrapException(ioe, user.getShortUserName(), argName, msg);
  }
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:22,
代码来源:AdminService.java

示例2: testModifyLabelsOnNodesWithDistributedConfigurationDisabled

点赞 3

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Test
public void testModifyLabelsOnNodesWithDistributedConfigurationDisabled()
    throws IOException, YarnException {
  // create RM and set it's ACTIVE
  MockRM rm = new MockRM();
  ((RMContextImpl) rm.getRMContext())
      .setHAServiceState(HAServiceState.ACTIVE);
  RMNodeLabelsManager labelMgr = rm.rmContext.getNodeLabelManager();

  // by default, distributed configuration for node label is disabled, this
  // should pass
  labelMgr.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
  rm.adminService.replaceLabelsOnNode(ReplaceLabelsOnNodeRequest
      .newInstance(ImmutableMap.of(NodeId.newInstance("host", 0),
          (Set<String>) ImmutableSet.of("x"))));
  rm.close();
}
 

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

示例3: testModifyLabelsOnNodesWithCentralizedConfigurationDisabled

点赞 3

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Test(expected = YarnException.class)
public void testModifyLabelsOnNodesWithCentralizedConfigurationDisabled()
    throws IOException, YarnException {
  // create RM and set it's ACTIVE, and set distributed node label
  // configuration to true
  MockRM rm = new MockRM();
  rm.adminService.isCentralizedNodeLabelConfiguration = false;

  ((RMContextImpl) rm.getRMContext())
      .setHAServiceState(HAServiceState.ACTIVE);
  RMNodeLabelsManager labelMgr = rm.rmContext.getNodeLabelManager();

  // by default, distributed configuration for node label is disabled, this
  // should pass
  labelMgr.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
  rm.adminService.replaceLabelsOnNode(ReplaceLabelsOnNodeRequest
      .newInstance(ImmutableMap.of(NodeId.newInstance("host", 0),
          (Set<String>) ImmutableSet.of("x"))));
  rm.close();
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:21,
代码来源:TestRMAdminService.java

示例4: updateNodeToLabelsMappings

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Override
public void updateNodeToLabelsMappings(
    Map<NodeId, Set<String>> nodeToLabels) throws IOException {
  ensureAppendEditlogFile();
  editlogOs.writeInt(SerializedLogType.NODE_TO_LABELS.ordinal());
  ((ReplaceLabelsOnNodeRequestPBImpl) ReplaceLabelsOnNodeRequest
      .newInstance(nodeToLabels)).getProto().writeDelimitedTo(editlogOs);
  ensureCloseEditlogFile();
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:10,
代码来源:FileSystemNodeLabelsStore.java

示例5: replaceLabelsOnNode

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Override
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
    ReplaceLabelsOnNodeRequest request) throws YarnException, IOException {
  ReplaceLabelsOnNodeRequestProto requestProto =
      ((ReplaceLabelsOnNodeRequestPBImpl) request).getProto();
  try {
    return new ReplaceLabelsOnNodeResponsePBImpl(proxy.replaceLabelsOnNodes(
        null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:14,
代码来源:ResourceManagerAdministrationProtocolPBClientImpl.java

示例6: replaceLabelsOnNodes

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
private int replaceLabelsOnNodes(Map<NodeId, Set<String>> map)
    throws IOException, YarnException {
  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).replaceLabelsOnNode(map);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    ReplaceLabelsOnNodeRequest request =
        ReplaceLabelsOnNodeRequest.newInstance(map);
    adminProtocol.replaceLabelsOnNode(request);
  }
  return 0;
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:14,
代码来源:RMAdminCLI.java

示例7: updateNodeToLabelsMappings

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Override
public void updateNodeToLabelsMappings(
    Map<NodeId, Set<String>> nodeToLabels) throws IOException {
  try {
    ensureAppendEditlogFile();
    editlogOs.writeInt(SerializedLogType.NODE_TO_LABELS.ordinal());
    ((ReplaceLabelsOnNodeRequestPBImpl) ReplaceLabelsOnNodeRequest
        .newInstance(nodeToLabels)).getProto().writeDelimitedTo(editlogOs);
  } finally {
    ensureCloseEditlogFile();
  }
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:13,
代码来源:FileSystemNodeLabelsStore.java

示例8: replaceLabelsOnNode

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Override
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
    ReplaceLabelsOnNodeRequest request) throws YarnException, IOException {
  String argName = "replaceLabelsOnNode";
  UserGroupInformation user = checkAcls(argName);

  if (!isRMActive()) {
    RMAuditLogger.logFailure(user.getShortUserName(), argName,
        adminAcl.toString(), "AdminService",
        "ResourceManager is not active. Can not set node to labels.");
    throwStandbyException();
  }

  ReplaceLabelsOnNodeResponse response =
      recordFactory.newRecordInstance(ReplaceLabelsOnNodeResponse.class);
  try {
    rmContext.getNodeLabelManager().replaceLabelsOnNode(
        request.getNodeToLabels());
    RMAuditLogger
        .logSuccess(user.getShortUserName(), argName, "AdminService");
    return response;
  } catch (IOException ioe) {
    LOG.info("Exception set node to labels. ", ioe);
    RMAuditLogger.logFailure(user.getShortUserName(), argName,
        adminAcl.toString(), "AdminService",
        "Exception set node to labels.");
    throw RPCUtil.getRemoteException(ioe);
  }
}
 

开发者ID:Nextzero,
项目名称:hadoop-2.6.0-cdh5.4.3,
代码行数:30,
代码来源:AdminService.java

示例9: replaceLabelsOnNodes

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
private int replaceLabelsOnNodes(Map<NodeId, Set<String>> map,
    boolean failOnUnknownNodes, boolean directlyAccessNodeLabelStore)
    throws IOException, YarnException {
  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).replaceLabelsOnNode(map);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    ReplaceLabelsOnNodeRequest request =
        ReplaceLabelsOnNodeRequest.newInstance(map);
    request.setFailOnUnknownNodes(failOnUnknownNodes);
    adminProtocol.replaceLabelsOnNode(request);
  }
  return 0;
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:16,
代码来源:RMAdminCLI.java

示例10: replaceLabelsOnNode

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Public
@Evolving
@Idempotent
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
    ReplaceLabelsOnNodeRequest request) throws YarnException, IOException;
 

开发者ID:naver,
项目名称:hadoop,
代码行数:6,
代码来源:ResourceManagerAdministrationProtocol.java

示例11: writeNewMirror

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
private void writeNewMirror() throws IOException {
  ReentrantReadWriteLock.ReadLock readLock = mgr.readLock;
  try {
    // Acquire readlock to make sure we get cluster node labels and
    // node-to-labels mapping atomically.
    readLock.lock();
    List<NodeLabel> nodeLabels = mgr.getClusterNodeLabels();
    Map<NodeId, Set<String>> nodeToLabels = mgr.getNodeLabels();
    
    // Write mirror to mirror.new.tmp file
    Path newTmpPath = new Path(fsWorkingPath, MIRROR_FILENAME + ".new.tmp"); 
    FSDataOutputStream os = fs
        .create(newTmpPath, true);
    ((AddToClusterNodeLabelsRequestPBImpl) AddToClusterNodeLabelsRequest
        .newInstance(nodeLabels)).getProto().writeDelimitedTo(os);

    if (mgr.isCentralizedConfiguration()) {
      // Only save node-to-labels mapping while using centralized configuration
      ((ReplaceLabelsOnNodeRequestPBImpl) ReplaceLabelsOnNodeRequest
          .newInstance(nodeToLabels)).getProto().writeDelimitedTo(os);
    }
    
    os.close();
    
    // Rename mirror.new.tmp to mirror.new (will remove .new if it's existed)
    Path newPath = new Path(fsWorkingPath, MIRROR_FILENAME + ".new"); 
    if (fs.exists(newPath)) {
      fs.delete(newPath, false);
    }
    fs.rename(newTmpPath, newPath);
    
    // Remove existing mirror and rename mirror.new to mirror
    Path mirrorPath = new Path(fsWorkingPath, MIRROR_FILENAME);
    if (fs.exists(mirrorPath)) {
      fs.delete(mirrorPath, false);
    }
    fs.rename(newPath, mirrorPath);
  } finally {
    readLock.unlock();
  }
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:42,
代码来源:NonAppendableFSNodeLabelStore.java

示例12: replaceLabelsOnNode

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest; //导入依赖的package包/类
@Private
@Idempotent
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
    ReplaceLabelsOnNodeRequest request) throws YarnException, IOException;
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:5,
代码来源:ResourceManagerAdministrationProtocol.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)