use of org.apache.tez.dag.app.rm.TaskSchedulerManager in project tez by apache.
the class TestDAGRecovery method setup.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Before
public void setup() {
conf = new Configuration();
conf.setBoolean(TezConfiguration.TEZ_AM_CONTAINER_REUSE_ENABLED, false);
appAttemptId = ApplicationAttemptId.newInstance(ApplicationId.newInstance(100, 1), 1);
dagId = TezDAGID.getInstance(appAttemptId.getApplicationId(), 1);
Assert.assertNotNull(dagId);
dagPlan = createDAGPlan();
dispatcher = new DrainDispatcher();
fsTokens = new Credentials();
appContext = mock(AppContext.class);
execService = mock(ListeningExecutorService.class);
thh = mock(TaskHeartbeatHandler.class);
final ListenableFuture<Void> mockFuture = mock(ListenableFuture.class);
when(appContext.getHadoopShim()).thenReturn(new DefaultHadoopShim());
when(appContext.getApplicationID()).thenReturn(appAttemptId.getApplicationId());
when(appContext.getClock()).thenReturn(new SystemClock());
Mockito.doAnswer(new Answer() {
public ListenableFuture<Void> answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
CallableEvent e = (CallableEvent) args[0];
dispatcher.getEventHandler().handle(e);
return mockFuture;
}
}).when(execService).submit((Callable<Void>) any());
doReturn(execService).when(appContext).getExecService();
historyEventHandler = new MockHistoryEventHandler(appContext);
aclManager = new ACLManager("amUser");
doReturn(conf).when(appContext).getAMConf();
doReturn(appAttemptId).when(appContext).getApplicationAttemptId();
doReturn(appAttemptId.getApplicationId()).when(appContext).getApplicationID();
doReturn(dagId).when(appContext).getCurrentDAGID();
doReturn(historyEventHandler).when(appContext).getHistoryHandler();
doReturn(aclManager).when(appContext).getAMACLManager();
doReturn(dagRecoveryData).when(appContext).getDAGRecoveryData();
dag = new DAGImpl(dagId, conf, dagPlan, dispatcher.getEventHandler(), taskCommunicatorManagerInterface, fsTokens, clock, "user", thh, appContext);
dag.entityUpdateTracker = new StateChangeNotifierForTest(dag);
doReturn(dag).when(appContext).getCurrentDAG();
ugi = mock(UserGroupInformation.class);
UserGroupInformation ugi = dag.getDagUGI();
doReturn(clusterInfo).when(appContext).getClusterInfo();
TaskSchedulerManager mockTaskScheduler = mock(TaskSchedulerManager.class);
doReturn(mockTaskScheduler).when(appContext).getTaskScheduler();
v1Id = TezVertexID.getInstance(dagId, 0);
t1v1Id = TezTaskID.getInstance(v1Id, 0);
ta1t1v1Id = TezTaskAttemptID.getInstance(t1v1Id, 0);
v2Id = TezVertexID.getInstance(dagId, 1);
t1v2Id = TezTaskID.getInstance(v2Id, 0);
ta1t1v2Id = TezTaskAttemptID.getInstance(t1v2Id, 0);
dispatcher.register(CallableEventType.class, new CallableEventDispatcher());
taskEventDispatcher = new TaskEventDispatcher();
dispatcher.register(TaskEventType.class, taskEventDispatcher);
taskAttemptEventDispatcher = new TaskAttemptEventDispatcher();
dispatcher.register(TaskAttemptEventType.class, taskAttemptEventDispatcher);
vertexEventDispatcher = new VertexEventDispatcher();
dispatcher.register(VertexEventType.class, vertexEventDispatcher);
dagEventDispatcher = new DagEventDispatcher();
dispatcher.register(DAGEventType.class, dagEventDispatcher);
dagFinishEventHandler = new DAGFinishEventHandler();
dispatcher.register(DAGAppMasterEventType.class, dagFinishEventHandler);
dispatcher.register(AMSchedulerEventType.class, new AMSchedulerEventDispatcher());
dispatcher.init(conf);
dispatcher.start();
doReturn(dispatcher.getEventHandler()).when(appContext).getEventHandler();
LogManager.getRootLogger().setLevel(Level.DEBUG);
}
use of org.apache.tez.dag.app.rm.TaskSchedulerManager 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.rm.TaskSchedulerManager 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.rm.TaskSchedulerManager 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