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


Java ResourceBlacklistRequest.getBlacklistAdditions方法代码示例

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


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

示例1: testSimpleBlacklistBelowFailureThreshold

import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest; //导入方法依赖的package包/类
@Test
public void testSimpleBlacklistBelowFailureThreshold() {
  final int numberOfNodeManagerHosts = 3;
  final double blacklistDisableFailureThreshold = 0.8;
  BlacklistManager manager = new SimpleBlacklistManager(
      numberOfNodeManagerHosts, blacklistDisableFailureThreshold);
  String anyNode = "foo";
  String anyNode2 = "bar";
  manager.addNode(anyNode);
  manager.addNode(anyNode2);
  ResourceBlacklistRequest blacklist = manager
      .getBlacklistUpdates();

  List<String> blacklistAdditions = blacklist.getBlacklistAdditions();
  Collections.sort(blacklistAdditions);
  List<String> blacklistRemovals = blacklist.getBlacklistRemovals();
  String[] expectedBlacklistAdditions = new String[]{anyNode2, anyNode};
  Assert.assertArrayEquals(
      "Blacklist additions was not as expected",
      expectedBlacklistAdditions,
      blacklistAdditions.toArray());
  Assert.assertTrue(
      "Blacklist removals should be empty but was " +
          blacklistRemovals,
      blacklistRemovals.isEmpty());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TestBlacklistManager.java

示例2: testDisabledBlacklist

import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest; //导入方法依赖的package包/类
@Test
public void testDisabledBlacklist() {
  BlacklistManager disabled = new DisabledBlacklistManager();
  String anyNode = "foo";
  disabled.addNode(anyNode);
  ResourceBlacklistRequest blacklist = disabled
      .getBlacklistUpdates();

  List<String> blacklistAdditions = blacklist.getBlacklistAdditions();
  List<String> blacklistRemovals = blacklist.getBlacklistRemovals();
  Assert.assertTrue(
      "Blacklist additions should be empty but was " +
          blacklistAdditions,
      blacklistAdditions.isEmpty());
  Assert.assertTrue(
      "Blacklist removals should be empty but was " +
          blacklistRemovals,
      blacklistRemovals.isEmpty());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:TestBlacklistManager.java

示例3: validateBlacklistRequest

import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest; //导入方法依赖的package包/类
public static void validateBlacklistRequest(
    ResourceBlacklistRequest blacklistRequest)
    throws InvalidResourceBlacklistRequestException {
  if (blacklistRequest != null) {
    List<String> plus = blacklistRequest.getBlacklistAdditions();
    if (plus != null && plus.contains(ResourceRequest.ANY)) {
      throw new InvalidResourceBlacklistRequestException(
          "Cannot add " + ResourceRequest.ANY + " to the blacklist!");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:RMServerUtils.java

示例4: validateBlacklistRequest

import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest; //导入方法依赖的package包/类
public static void validateBlacklistRequest(ResourceBlacklistRequest blacklistRequest) 
throws InvalidResourceBlacklistRequestException {
  if (blacklistRequest != null) {
    List<String> plus = blacklistRequest.getBlacklistAdditions();
    if (plus != null && plus.contains(ResourceRequest.ANY)) {
      throw new InvalidResourceBlacklistRequestException(
          "Cannot add " + ResourceRequest.ANY + " to the blacklist!");
    }
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:11,代码来源:SchedulerUtils.java

示例5: testSimpleBlacklistAboveFailureThreshold

import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest; //导入方法依赖的package包/类
@Test
public void testSimpleBlacklistAboveFailureThreshold() {
  // Create a threshold of 0.5 * 3 i.e at 1.5 node failures.
  BlacklistManager manager = new SimpleBlacklistManager(3, 0.5);
  String anyNode = "foo";
  String anyNode2 = "bar";
  manager.addNode(anyNode);
  ResourceBlacklistRequest blacklist = manager
      .getBlacklistUpdates();

  List<String> blacklistAdditions = blacklist.getBlacklistAdditions();
  Collections.sort(blacklistAdditions);
  List<String> blacklistRemovals = blacklist.getBlacklistRemovals();
  String[] expectedBlacklistAdditions = new String[]{anyNode};
  Assert.assertArrayEquals(
      "Blacklist additions was not as expected",
      expectedBlacklistAdditions,
      blacklistAdditions.toArray());
  Assert.assertTrue(
      "Blacklist removals should be empty but was " +
          blacklistRemovals,
      blacklistRemovals.isEmpty());

  manager.addNode(anyNode2);

  blacklist = manager
      .getBlacklistUpdates();
  blacklistAdditions = blacklist.getBlacklistAdditions();
  Collections.sort(blacklistAdditions);
  blacklistRemovals = blacklist.getBlacklistRemovals();
  Collections.sort(blacklistRemovals);
  String[] expectedBlacklistRemovals = new String[] {anyNode2, anyNode};
  Assert.assertTrue(
      "Blacklist additions should be empty but was " +
          blacklistAdditions,
      blacklistAdditions.isEmpty());
  Assert.assertArrayEquals(
      "Blacklist removals was not as expected",
      expectedBlacklistRemovals,
      blacklistRemovals.toArray());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:42,代码来源:TestBlacklistManager.java


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