Search in sources :

Example 11 with TaskAttemptIdentifier

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;
}
Also used : TaskIdentifier(org.apache.tez.runtime.api.TaskIdentifier) VertexIdentifier(org.apache.tez.runtime.api.VertexIdentifier) TaskAttemptIdentifier(org.apache.tez.runtime.api.TaskAttemptIdentifier)

Example 12 with TaskAttemptIdentifier

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());
}
Also used : VertexStateUpdate(org.apache.tez.dag.api.event.VertexStateUpdate) ArrayList(java.util.ArrayList) TaskAttemptIdentifier(org.apache.tez.runtime.api.TaskAttemptIdentifier) ScheduleTaskRequest(org.apache.tez.dag.api.VertexManagerPluginContext.ScheduleTaskRequest)

Aggregations

TaskAttemptIdentifier (org.apache.tez.runtime.api.TaskAttemptIdentifier)12 HashMap (java.util.HashMap)6 EdgeProperty (org.apache.tez.dag.api.EdgeProperty)5 VertexStateUpdate (org.apache.tez.dag.api.event.VertexStateUpdate)5 VertexManagerPluginContext (org.apache.tez.dag.api.VertexManagerPluginContext)3 Test (org.junit.Test)3 ByteString (com.google.protobuf.ByteString)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 ScheduleTaskRequest (org.apache.tez.dag.api.VertexManagerPluginContext.ScheduleTaskRequest)2 TaskIdentifier (org.apache.tez.runtime.api.TaskIdentifier)2 VertexIdentifier (org.apache.tez.runtime.api.VertexIdentifier)2 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Container (org.apache.hadoop.yarn.api.records.Container)1 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)1 EdgeManagerPluginDescriptor (org.apache.tez.dag.api.EdgeManagerPluginDescriptor)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1