use of org.apache.tez.dag.app.AppContext in project tez by apache.
the class TestAMNodeTracker method testHealthUpdateUnknownNode.
@Test(timeout = 5000)
public void testHealthUpdateUnknownNode() {
AppContext appContext = mock(AppContext.class);
AMNodeTracker amNodeTracker = new AMNodeTracker(eventHandler, appContext);
doReturn(amNodeTracker).when(appContext).getNodeTracker();
amNodeTracker.init(new Configuration(false));
amNodeTracker.start();
NodeId nodeId = NodeId.newInstance("unknownhost", 2342);
NodeReport nodeReport = generateNodeReport(nodeId, NodeState.UNHEALTHY);
amNodeTracker.handle(new AMNodeEventStateChanged(nodeReport, 0));
dispatcher.await();
amNodeTracker.stop();
// No exceptions - the status update was ignored. Not bothering to capture
// the log message for verification.
}
use of org.apache.tez.dag.app.AppContext in project tez by apache.
the class TestAMNodeTracker method testNodeSelfBlacklistAlternateScheduler1.
@Test(timeout = 10000)
public void testNodeSelfBlacklistAlternateScheduler1() {
AppContext appContext = mock(AppContext.class);
Configuration conf = new Configuration(false);
conf.setInt(TezConfiguration.TEZ_AM_MAX_TASK_FAILURES_PER_NODE, 2);
TestEventHandler handler = new TestEventHandler();
AMNodeTracker amNodeTracker = new AMNodeTracker(handler, appContext);
doReturn(amNodeTracker).when(appContext).getNodeTracker();
AMContainerMap amContainerMap = mock(AMContainerMap.class);
TaskSchedulerManager taskSchedulerManager = mock(TaskSchedulerManager.class);
dispatcher.register(AMNodeEventType.class, amNodeTracker);
dispatcher.register(AMContainerEventType.class, amContainerMap);
dispatcher.register(AMSchedulerEventType.class, taskSchedulerManager);
amNodeTracker.init(conf);
amNodeTracker.start();
try {
_testNodeSelfBlacklist(amNodeTracker, handler, 1);
} finally {
amNodeTracker.stop();
}
}
use of org.apache.tez.dag.app.AppContext in project tez by apache.
the class TestAMNodeTracker method testNodeSelfBlacklist.
@Test(timeout = 10000)
public void testNodeSelfBlacklist() {
AppContext appContext = mock(AppContext.class);
Configuration conf = new Configuration(false);
conf.setInt(TezConfiguration.TEZ_AM_MAX_TASK_FAILURES_PER_NODE, 2);
TestEventHandler handler = new TestEventHandler();
AMNodeTracker amNodeTracker = new AMNodeTracker(handler, appContext);
doReturn(amNodeTracker).when(appContext).getNodeTracker();
AMContainerMap amContainerMap = mock(AMContainerMap.class);
TaskSchedulerManager taskSchedulerManager = mock(TaskSchedulerManager.class);
dispatcher.register(AMNodeEventType.class, amNodeTracker);
dispatcher.register(AMContainerEventType.class, amContainerMap);
dispatcher.register(AMSchedulerEventType.class, taskSchedulerManager);
amNodeTracker.init(conf);
amNodeTracker.start();
try {
_testNodeSelfBlacklist(amNodeTracker, handler, 0);
} finally {
amNodeTracker.stop();
}
}
use of org.apache.tez.dag.app.AppContext in project tez by apache.
the class TestAMNodeTracker method testHealthUpdateKnownNode.
@Test(timeout = 5000)
public void testHealthUpdateKnownNode() {
AppContext appContext = mock(AppContext.class);
AMNodeTracker amNodeTracker = new AMNodeTracker(eventHandler, appContext);
doReturn(amNodeTracker).when(appContext).getNodeTracker();
amNodeTracker.init(new Configuration(false));
amNodeTracker.start();
NodeId nodeId = NodeId.newInstance("host1", 2342);
amNodeTracker.nodeSeen(nodeId, 0);
NodeReport nodeReport = generateNodeReport(nodeId, NodeState.UNHEALTHY);
amNodeTracker.handle(new AMNodeEventStateChanged(nodeReport, 0));
dispatcher.await();
assertEquals(AMNodeState.UNHEALTHY, amNodeTracker.get(nodeId, 0).getState());
amNodeTracker.stop();
}
use of org.apache.tez.dag.app.AppContext in project tez by apache.
the class TestAMNodeTracker method testSingleNodeNotBlacklistedAlternateScheduler2.
@Test(timeout = 5000)
public void testSingleNodeNotBlacklistedAlternateScheduler2() {
AppContext appContext = mock(AppContext.class);
Configuration conf = new Configuration(false);
conf.setInt(TezConfiguration.TEZ_AM_MAX_TASK_FAILURES_PER_NODE, 2);
conf.setBoolean(TezConfiguration.TEZ_AM_NODE_BLACKLISTING_ENABLED, true);
conf.setInt(TezConfiguration.TEZ_AM_NODE_BLACKLISTING_IGNORE_THRESHOLD, 33);
TestEventHandler handler = new TestEventHandler();
AMNodeTracker amNodeTracker = new AMNodeTracker(handler, appContext);
doReturn(amNodeTracker).when(appContext).getNodeTracker();
AMContainerMap amContainerMap = mock(AMContainerMap.class);
TaskSchedulerManager taskSchedulerManager = mock(TaskSchedulerManager.class);
dispatcher.register(AMNodeEventType.class, amNodeTracker);
dispatcher.register(AMContainerEventType.class, amContainerMap);
dispatcher.register(AMSchedulerEventType.class, taskSchedulerManager);
amNodeTracker.init(conf);
amNodeTracker.start();
// This should not affect the blacklisting behaviour
for (int i = 0; i < 10; i++) {
amNodeTracker.nodeSeen(NodeId.newInstance("fakenode" + i, 3333), 0);
}
_testSingleNodeNotBlacklisted(amNodeTracker, handler, 1);
// No impact on blacklisting for the alternate source
assertFalse(amNodeTracker.isBlacklistingIgnored(0));
}
Aggregations