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

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

java 1次浏览

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

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

示例1: addToClusterNodeLabels

点赞 3

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

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

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

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

示例2: addToClusterNodeLabels

点赞 3

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
@Override
public AddToClusterNodeLabelsResponse addToClusterNodeLabels(AddToClusterNodeLabelsRequest request)
    throws YarnException, IOException {
  final String operation = "addToClusterNodeLabels";
  final String msg = "add labels.";
  UserGroupInformation user = checkAcls(operation);

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

  AddToClusterNodeLabelsResponse response =
      recordFactory.newRecordInstance(AddToClusterNodeLabelsResponse.class);
  try {
    rmContext.getNodeLabelManager()
        .addToCluserNodeLabels(request.getNodeLabels());
    RMAuditLogger.logSuccess(user.getShortUserName(), operation,
        "AdminService");
    return response;
  } catch (IOException ioe) {
    throw logAndWrapException(ioe, user.getShortUserName(), operation, msg);
  }
}
 

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

示例3: storeNewClusterNodeLabels

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
@Override
public void storeNewClusterNodeLabels(Set<String> labels)
    throws IOException {
  ensureAppendEditlogFile();
  editlogOs.writeInt(SerializedLogType.ADD_LABELS.ordinal());
  ((AddToClusterNodeLabelsRequestPBImpl) AddToClusterNodeLabelsRequest.newInstance(labels)).getProto()
      .writeDelimitedTo(editlogOs);
  ensureCloseEditlogFile();
}
 

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

示例4: addToClusterNodeLabels

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
@Override
public AddToClusterNodeLabelsResponse addToClusterNodeLabels(
    AddToClusterNodeLabelsRequest request) throws YarnException, IOException {
  AddToClusterNodeLabelsRequestProto requestProto =
      ((AddToClusterNodeLabelsRequestPBImpl) request).getProto();
  try {
    return new AddToClusterNodeLabelsResponsePBImpl(
        proxy.addToClusterNodeLabels(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 

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

示例5: addToClusterNodeLabels

点赞 2

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

  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).addToCluserNodeLabels(labels);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    AddToClusterNodeLabelsRequest request =
        AddToClusterNodeLabelsRequest.newInstance(labels);
    adminProtocol.addToClusterNodeLabels(request);
  }
  return 0;
}
 

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

示例6: storeNewClusterNodeLabels

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
@Override
public void storeNewClusterNodeLabels(List<NodeLabel> labels)
    throws IOException {
  try {
    ensureAppendEditlogFile();
    editlogOs.writeInt(SerializedLogType.ADD_LABELS.ordinal());
    ((AddToClusterNodeLabelsRequestPBImpl) AddToClusterNodeLabelsRequest
        .newInstance(labels)).getProto().writeDelimitedTo(editlogOs);
  } finally {
    ensureCloseEditlogFile();
  }
}
 

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

示例7: addToClusterNodeLabels

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
private int addToClusterNodeLabels(String args) throws IOException,
    YarnException {
  List<NodeLabel> labels = buildNodeLabelsFromStr(args);

  if (directlyAccessNodeLabelStore) {
    getNodeLabelManagerInstance(getConf()).addToCluserNodeLabels(labels);
  } else {
    ResourceManagerAdministrationProtocol adminProtocol =
        createAdminProtocol();
    AddToClusterNodeLabelsRequest request =
        AddToClusterNodeLabelsRequest.newInstance(labels);
    adminProtocol.addToClusterNodeLabels(request);
  }
  return 0;
}
 

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

示例8: addToClusterNodeLabels

点赞 2

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

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

  AddToClusterNodeLabelsResponse response =
      recordFactory.newRecordInstance(AddToClusterNodeLabelsResponse.class);
  try {
    rmContext.getNodeLabelManager().addToCluserNodeLabels(request.getNodeLabels());
    RMAuditLogger
        .logSuccess(user.getShortUserName(), argName, "AdminService");
    return response;
  } catch (IOException ioe) {
    LOG.info("Exception add labels", ioe);
    RMAuditLogger.logFailure(user.getShortUserName(), argName,
        adminAcl.toString(), "AdminService", "Exception add label");
    throw RPCUtil.getRemoteException(ioe);
  }
}
 

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

示例9: addToClusterNodeLabels

点赞 2

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

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

示例10: handleAddToClusterNodeLabels

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
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 = 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;
}
 

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

示例11: addToClusterNodeLabels

点赞 2

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

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

示例12: writeNewMirror

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的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

示例13: configure

点赞 2

import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest; //导入依赖的package包/类
@SuppressWarnings("static-access")
@Before
public void configure() throws IOException, YarnException {
  remoteAdminServiceAccessed = false;
  admin = mock(ResourceManagerAdministrationProtocol.class);
  when(admin.addToClusterNodeLabels(any(AddToClusterNodeLabelsRequest.class)))
      .thenAnswer(new Answer<AddToClusterNodeLabelsResponse>() {

        @Override
        public AddToClusterNodeLabelsResponse answer(
            InvocationOnMock invocation) throws Throwable {
          remoteAdminServiceAccessed = true;
          return AddToClusterNodeLabelsResponse.newInstance();
        }
      });

  haadmin = mock(HAServiceProtocol.class);
  when(haadmin.getServiceStatus()).thenReturn(new HAServiceStatus(
      HAServiceProtocol.HAServiceState.INITIALIZING));

  final HAServiceTarget haServiceTarget = mock(HAServiceTarget.class);
  when(haServiceTarget.getProxy(any(Configuration.class), anyInt()))
      .thenReturn(haadmin);
  rmAdminCLI = new RMAdminCLI(new Configuration()) {
    @Override
    protected ResourceManagerAdministrationProtocol createAdminProtocol()
        throws IOException {
      return admin;
    }

    @Override
    protected HAServiceTarget resolveTarget(String rmId) {
      return haServiceTarget;
    }
  };
  initDummyNodeLabelsManager();
  rmAdminCLI.localNodeLabelsManager = dummyNodeLabelsManager;

  YarnConfiguration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
  conf.set(YarnConfiguration.RM_HA_IDS, "rm1,rm2");
  rmAdminCLIWithHAEnabled = new RMAdminCLI(conf) {

    @Override
    protected ResourceManagerAdministrationProtocol createAdminProtocol()
        throws IOException {
      return admin;
    }

    @Override
    protected HAServiceTarget resolveTarget(String rmId) {
      return haServiceTarget;
    }
  };
}
 

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

示例14: addToClusterNodeLabels

点赞 2

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

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


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