use of org.apache.tez.runtime.api.TaskAttemptIdentifier in project tez by apache.
the class TestShuffleVertexManagerUtils method createTaskAttemptIdentifier.
public static TaskAttemptIdentifier createTaskAttemptIdentifier(String vName, int tId) {
VertexIdentifier mockVertex = mock(VertexIdentifier.class);
when(mockVertex.getName()).thenReturn(vName);
TaskIdentifier mockTask = mock(TaskIdentifier.class);
when(mockTask.getIdentifier()).thenReturn(tId);
when(mockTask.getVertexIdentifier()).thenReturn(mockVertex);
TaskAttemptIdentifier mockAttempt = mock(TaskAttemptIdentifier.class);
when(mockAttempt.getIdentifier()).thenReturn(0);
when(mockAttempt.getTaskIdentifier()).thenReturn(mockTask);
return mockAttempt;
}
use of org.apache.tez.runtime.api.TaskAttemptIdentifier in project tez by apache.
the class TestCartesianProductVertexManagerPartitioned method testOnVertexStartHelper.
private void testOnVertexStartHelper(boolean broadcastRunning) throws Exception {
vertexManager.onVertexStateUpdated(new VertexStateUpdate("v0", VertexState.CONFIGURED));
vertexManager.onVertexStateUpdated(new VertexStateUpdate("v1", VertexState.CONFIGURED));
if (broadcastRunning) {
vertexManager.onVertexStateUpdated(new VertexStateUpdate("v2", VertexState.RUNNING));
}
List<TaskAttemptIdentifier> completions = new ArrayList<>();
completions.add(allCompletions.get(0));
completions.add(allCompletions.get(1));
completions.add(allCompletions.get(4));
completions.add(allCompletions.get(8));
vertexManager.onVertexStarted(completions);
if (!broadcastRunning) {
verify(context, never()).scheduleTasks(Matchers.<List<ScheduleTaskRequest>>any());
vertexManager.onVertexStateUpdated(new VertexStateUpdate("v2", VertexState.RUNNING));
}
List<ScheduleTaskRequest> scheduleTaskRequests;
verify(context, times(1)).scheduleTasks(scheduleTaskRequestCaptor.capture());
scheduleTaskRequests = scheduleTaskRequestCaptor.getValue();
assertEquals(1, scheduleTaskRequests.size());
assertEquals(0, scheduleTaskRequests.get(0).getTaskIndex());
}
Aggregations