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


Java RMNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity方法的典型用法代码示例。如果您正苦于以下问题:Java RMNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity方法的具体用法?Java RMNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity怎么用?Java RMNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager的用法示例。


在下文中一共展示了RMNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testModifyLabelsOnNodesWithDistributedConfigurationDisabled

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的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

示例2: testModifyLabelsOnNodesWithCentralizedConfigurationDisabled

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的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

示例3: testRemoveClusterNodeLabelsWithCentralizedConfigurationDisabled

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test
public void testRemoveClusterNodeLabelsWithCentralizedConfigurationDisabled()
    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();
  rm.adminService.isCentralizedNodeLabelConfiguration = false;

  // by default, distributed configuration for node label is disabled, this
  // should pass
  labelMgr.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
  rm.adminService
      .removeFromClusterNodeLabels(RemoveFromClusterNodeLabelsRequest
          .newInstance((Set<String>) ImmutableSet.of("x")));

  Set<String> clusterNodeLabels = labelMgr.getClusterNodeLabelNames();
  assertEquals(1,clusterNodeLabels.size());
  rm.close();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TestRMAdminService.java

示例4: initializeNodeLabels

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
private void initializeNodeLabels() throws IOException {
  RMContext rmContext = distShellTest.yarnCluster.getResourceManager(0).getRMContext();

  // Setup node labels
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  Set<String> labels = new HashSet<String>();
  labels.add("x");
  labelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(labels);

  // Setup queue access to node labels
  distShellTest.conf.set("yarn.scheduler.capacity.root.accessible-node-labels", "x");
  distShellTest.conf.set("yarn.scheduler.capacity.root.accessible-node-labels.x.capacity",
      "100");
  distShellTest.conf.set("yarn.scheduler.capacity.root.default.accessible-node-labels", "x");
  distShellTest.conf.set(
      "yarn.scheduler.capacity.root.default.accessible-node-labels.x.capacity",
      "100");

  rmContext.getScheduler().reinitialize(distShellTest.conf, rmContext);

  // Fetch node-ids from yarn cluster
  NodeId[] nodeIds = new NodeId[NUM_NMS];
  for (int i = 0; i < NUM_NMS; i++) {
    NodeManager mgr = distShellTest.yarnCluster.getNodeManager(i);
    nodeIds[i] = mgr.getNMContext().getNodeId();
  }

  // Set label x to NM[1]
  labelsMgr.addLabelsToNode(ImmutableMap.of(nodeIds[1], labels));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:31,代码来源:TestDistributedShellWithNodeLabels.java

示例5: testRMRestartNodeMapping

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test(timeout = 20000)
public void testRMRestartNodeMapping() throws Exception {
  // Initial FS node label store root dir to a random tmp dir
  File nodeLabelFsStoreDir = new File("target",
      this.getClass().getSimpleName() + "-testRMRestartNodeMapping");
  if (nodeLabelFsStoreDir.exists()) {
    FileUtils.deleteDirectory(nodeLabelFsStoreDir);
  }
  nodeLabelFsStoreDir.deleteOnExit();
  String nodeLabelFsStoreDirURI = nodeLabelFsStoreDir.toURI().toString();
  conf.set(YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR,
      nodeLabelFsStoreDirURI);

  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, true);
  MockRM rm1 = new MockRM(conf, memStore) {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      RMNodeLabelsManager mgr = new RMNodeLabelsManager();
      mgr.init(getConfig());
      return mgr;
    }
  };
  rm1.init(conf);
  rm1.start();
  RMNodeLabelsManager nodeLabelManager =
      rm1.getRMContext().getNodeLabelManager();

  Set<String> clusterNodeLabels = new HashSet<String>();
  clusterNodeLabels.add("x");
  clusterNodeLabels.add("y");
  nodeLabelManager
      .addToCluserNodeLabelsWithDefaultExclusivity(clusterNodeLabels);
  // Add node Label to Node h1->x
  NodeId n1 = NodeId.newInstance("h1", 1234);
  NodeId n2 = NodeId.newInstance("h1", 1235);
  NodeId nihost = NodeId.newInstance("h1", 0);
  nodeLabelManager.replaceLabelsOnNode(ImmutableMap.of(n1, toSet("x")));
  nodeLabelManager.replaceLabelsOnNode(ImmutableMap.of(n2, toSet("x")));
  nodeLabelManager.replaceLabelsOnNode(ImmutableMap.of(nihost, toSet("y")));
  nodeLabelManager.replaceLabelsOnNode(ImmutableMap.of(n1, toSet("x")));
  MockRM rm2 = null;
  for (int i = 0; i < 2; i++) {
    rm2 = new MockRM(conf, memStore) {
      @Override
      protected RMNodeLabelsManager createNodeLabelManager() {
        RMNodeLabelsManager mgr = new RMNodeLabelsManager();
        mgr.init(getConfig());
        return mgr;
      }
    };
    rm2.init(conf);
    rm2.start();

    nodeLabelManager = rm2.getRMContext().getNodeLabelManager();
    Map<String, Set<NodeId>> labelsToNodes =
        nodeLabelManager.getLabelsToNodes(toSet("x"));
    Assert.assertEquals(1,
        null == labelsToNodes.get("x") ? 0 : labelsToNodes.get("x").size());
  }
  rm1.stop();
  rm2.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:65,代码来源:TestRMRestart.java

示例6: testContainerAllocationWithSingleUserLimits

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test (timeout = 300000)
public void testContainerAllocationWithSingleUserLimits() throws Exception {
  final RMNodeLabelsManager mgr = new NullRMNodeLabelsManager();
  mgr.init(conf);

  // set node -> label
  mgr.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
  mgr.addLabelsToNode(ImmutableMap.of(NodeId.newInstance("h1", 0), toSet("x"),
      NodeId.newInstance("h2", 0), toSet("y")));

  // inject node label manager
  MockRM rm1 = new MockRM(TestUtils.getConfigurationWithDefaultQueueLabels(conf)) {
    @Override
    public RMNodeLabelsManager createNodeLabelManager() {
      return mgr;
    }
  };

  rm1.getRMContext().setNodeLabelManager(mgr);
  rm1.start();
  MockNM nm1 = rm1.registerNode("h1:1234", 8000); // label = x
  rm1.registerNode("h2:1234", 8000); // label = y
  MockNM nm3 = rm1.registerNode("h3:1234", 8000); // label = <empty>

  // launch an app to queue a1 (label = x), and check all container will
  // be allocated in h1
  RMApp app1 = rm1.submitApp(200, "app", "user", null, "a1");
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
  
  // A has only 10% of x, so it can only allocate one container in label=empty
  ContainerId containerId =
      ContainerId.newContainerId(am1.getApplicationAttemptId(), 2);
  am1.allocate("*", 1024, 1, new ArrayList<ContainerId>(), "");
  Assert.assertTrue(rm1.waitForState(nm3, containerId,
        RMContainerState.ALLOCATED, 10 * 1000));
  // Cannot allocate 2nd label=empty container
  containerId =
      ContainerId.newContainerId(am1.getApplicationAttemptId(), 3);
  am1.allocate("*", 1024, 1, new ArrayList<ContainerId>(), "");
  Assert.assertFalse(rm1.waitForState(nm3, containerId,
        RMContainerState.ALLOCATED, 10 * 1000));

  // A has default user limit = 100, so it can use all resource in label = x
  // We can allocate floor(8000 / 1024) = 7 containers
  for (int id = 3; id <= 8; id++) {
    containerId =
        ContainerId.newContainerId(am1.getApplicationAttemptId(), id);
    am1.allocate("*", 1024, 1, new ArrayList<ContainerId>(), "x");
    Assert.assertTrue(rm1.waitForState(nm1, containerId,
        RMContainerState.ALLOCATED, 10 * 1000));
  }
  rm1.close();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:54,代码来源:TestNodeLabelContainerAllocation.java

示例7: testNodeRegistrationWithLabels

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test
public void testNodeRegistrationWithLabels() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH,
      hostFile.getAbsolutePath());
  conf.set(YarnConfiguration.NODELABEL_CONFIGURATION_TYPE,
      YarnConfiguration.DISTRIBUTED_NODELABEL_CONFIGURATION_TYPE);

  final RMNodeLabelsManager nodeLabelsMgr = new NullRMNodeLabelsManager();

  rm = new MockRM(conf) {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      return nodeLabelsMgr;
    }
  };
  rm.start();

  try {
    nodeLabelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("A", "B", "C"));
  } catch (IOException e) {
    Assert.fail("Caught Exception while intializing");
    e.printStackTrace();
  }

  ResourceTrackerService resourceTrackerService =
      rm.getResourceTrackerService();
  RegisterNodeManagerRequest registerReq =
      Records.newRecord(RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  registerReq.setResource(capability);
  registerReq.setNodeId(nodeId);
  registerReq.setHttpPort(1234);
  registerReq.setNMVersion(YarnVersionInfo.getVersion());
  registerReq.setNodeLabels(toSet(NodeLabel.newInstance("A")));
  RegisterNodeManagerResponse response =
      resourceTrackerService.registerNodeManager(registerReq);

  Assert.assertEquals("Action should be normal on valid Node Labels",
      NodeAction.NORMAL, response.getNodeAction());
  assertCollectionEquals(nodeLabelsMgr.getNodeLabels().get(nodeId),
      NodeLabelsUtils.convertToStringSet(registerReq.getNodeLabels()));
  Assert.assertTrue("Valid Node Labels were not accepted by RM",
      response.getAreNodeLabelsAcceptedByRM());
  rm.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:49,代码来源:TestResourceTrackerService.java

示例8: testNodeRegistrationWithInvalidLabels

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test
public void testNodeRegistrationWithInvalidLabels() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH,
      hostFile.getAbsolutePath());
  conf.set(YarnConfiguration.NODELABEL_CONFIGURATION_TYPE,
      YarnConfiguration.DISTRIBUTED_NODELABEL_CONFIGURATION_TYPE);

  final RMNodeLabelsManager nodeLabelsMgr = new NullRMNodeLabelsManager();

  rm = new MockRM(conf) {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      return nodeLabelsMgr;
    }
  };
  rm.start();

  try {
    nodeLabelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("X", "Y", "Z"));
  } catch (IOException e) {
    Assert.fail("Caught Exception while intializing");
    e.printStackTrace();
  }

  ResourceTrackerService resourceTrackerService =
      rm.getResourceTrackerService();
  RegisterNodeManagerRequest registerReq =
      Records.newRecord(RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  registerReq.setResource(capability);
  registerReq.setNodeId(nodeId);
  registerReq.setHttpPort(1234);
  registerReq.setNMVersion(YarnVersionInfo.getVersion());
  registerReq.setNodeLabels(toNodeLabelSet("A", "B", "C"));
  RegisterNodeManagerResponse response =
      resourceTrackerService.registerNodeManager(registerReq);

  Assert.assertEquals(
      "On Invalid Node Labels action is expected to be normal",
      NodeAction.NORMAL, response.getNodeAction());
  Assert.assertNull(nodeLabelsMgr.getNodeLabels().get(nodeId));
  Assert.assertNotNull(response.getDiagnosticsMessage());
  Assert.assertFalse("Node Labels should not accepted by RM If Invalid",
      response.getAreNodeLabelsAcceptedByRM());

  if (rm != null) {
    rm.stop();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:53,代码来源:TestResourceTrackerService.java

示例9: testNodeRegistrationWithInvalidLabelsSyntax

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test
public void testNodeRegistrationWithInvalidLabelsSyntax() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH,
      hostFile.getAbsolutePath());
  conf.set(YarnConfiguration.NODELABEL_CONFIGURATION_TYPE,
      YarnConfiguration.DISTRIBUTED_NODELABEL_CONFIGURATION_TYPE);

  final RMNodeLabelsManager nodeLabelsMgr = new NullRMNodeLabelsManager();

  rm = new MockRM(conf) {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      return nodeLabelsMgr;
    }
  };
  rm.start();

  try {
    nodeLabelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("X", "Y", "Z"));
  } catch (IOException e) {
    Assert.fail("Caught Exception while intializing");
    e.printStackTrace();
  }

  ResourceTrackerService resourceTrackerService =
      rm.getResourceTrackerService();
  RegisterNodeManagerRequest req =
      Records.newRecord(RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  req.setResource(capability);
  req.setNodeId(nodeId);
  req.setHttpPort(1234);
  req.setNMVersion(YarnVersionInfo.getVersion());
  req.setNodeLabels(toNodeLabelSet("#Y"));
  RegisterNodeManagerResponse response =
      resourceTrackerService.registerNodeManager(req);

  Assert.assertEquals(
      "On Invalid Node Labels action is expected to be normal",
      NodeAction.NORMAL, response.getNodeAction());
  Assert.assertNull(nodeLabelsMgr.getNodeLabels().get(nodeId));
  Assert.assertNotNull(response.getDiagnosticsMessage());
  Assert.assertFalse("Node Labels should not accepted by RM If Invalid",
      response.getAreNodeLabelsAcceptedByRM());

  if (rm != null) {
    rm.stop();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:53,代码来源:TestResourceTrackerService.java

示例10: testNodeRegistrationWithCentralLabelConfig

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test
public void testNodeRegistrationWithCentralLabelConfig() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH,
      hostFile.getAbsolutePath());
  conf.set(YarnConfiguration.NODELABEL_CONFIGURATION_TYPE,
      YarnConfiguration.DEFAULT_NODELABEL_CONFIGURATION_TYPE);

  final RMNodeLabelsManager nodeLabelsMgr = new NullRMNodeLabelsManager();

  rm = new MockRM(conf) {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      return nodeLabelsMgr;
    }
  };
  rm.start();
  try {
    nodeLabelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("A", "B", "C"));
  } catch (IOException e) {
    Assert.fail("Caught Exception while intializing");
    e.printStackTrace();
  }
  ResourceTrackerService resourceTrackerService =
      rm.getResourceTrackerService();
  RegisterNodeManagerRequest req =
      Records.newRecord(RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  req.setResource(capability);
  req.setNodeId(nodeId);
  req.setHttpPort(1234);
  req.setNMVersion(YarnVersionInfo.getVersion());
  req.setNodeLabels(toNodeLabelSet("A"));
  RegisterNodeManagerResponse response =
      resourceTrackerService.registerNodeManager(req);
  // registered to RM with central label config
  Assert.assertEquals(NodeAction.NORMAL, response.getNodeAction());
  Assert.assertNull(nodeLabelsMgr.getNodeLabels().get(nodeId));
  Assert
      .assertFalse(
          "Node Labels should not accepted by RM If its configured with Central configuration",
          response.getAreNodeLabelsAcceptedByRM());
  if (rm != null) {
    rm.stop();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:49,代码来源:TestResourceTrackerService.java

示例11: testNodeHeartBeatWithInvalidLabels

import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; //导入方法依赖的package包/类
@Test
public void testNodeHeartBeatWithInvalidLabels() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH,
      hostFile.getAbsolutePath());
  conf.set(YarnConfiguration.NODELABEL_CONFIGURATION_TYPE,
      YarnConfiguration.DISTRIBUTED_NODELABEL_CONFIGURATION_TYPE);

  final RMNodeLabelsManager nodeLabelsMgr = new NullRMNodeLabelsManager();

  rm = new MockRM(conf) {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      return nodeLabelsMgr;
    }
  };
  rm.start();

  try {
    nodeLabelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("A", "B", "C"));
  } catch (IOException e) {
    Assert.fail("Caught Exception while intializing");
    e.printStackTrace();
  }

  ResourceTrackerService resourceTrackerService =
      rm.getResourceTrackerService();
  RegisterNodeManagerRequest registerReq =
      Records.newRecord(RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  registerReq.setResource(capability);
  registerReq.setNodeId(nodeId);
  registerReq.setHttpPort(1234);
  registerReq.setNMVersion(YarnVersionInfo.getVersion());
  registerReq.setNodeLabels(toNodeLabelSet("A"));
  RegisterNodeManagerResponse registerResponse =
      resourceTrackerService.registerNodeManager(registerReq);

  NodeHeartbeatRequest heartbeatReq =
      Records.newRecord(NodeHeartbeatRequest.class);
  heartbeatReq.setNodeLabels(toNodeLabelSet("B", "#C")); // Invalid heart beat labels
  heartbeatReq.setNodeStatus(getNodeStatusObject(nodeId));
  heartbeatReq.setLastKnownNMTokenMasterKey(registerResponse
      .getNMTokenMasterKey());
  heartbeatReq.setLastKnownContainerTokenMasterKey(registerResponse
      .getContainerTokenMasterKey());
  NodeHeartbeatResponse nodeHeartbeatResponse =
      resourceTrackerService.nodeHeartbeat(heartbeatReq);

  // response should be NORMAL when RM heartbeat labels are rejected
  Assert.assertEquals("Response should be NORMAL when RM heartbeat labels"
      + " are rejected", NodeAction.NORMAL,
      nodeHeartbeatResponse.getNodeAction());
  Assert.assertFalse(nodeHeartbeatResponse.getAreNodeLabelsAcceptedByRM());
  Assert.assertNotNull(nodeHeartbeatResponse.getDiagnosticsMessage());
  rm.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:60,代码来源:TestResourceTrackerService.java


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