本文整理汇总了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());
}
示例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());
}
示例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!");
}
}
}
示例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!");
}
}
}
示例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());
}