Java Code Examples for org.apache.tez.dag.api.client.DAGClient#waitForCompletion()

The following examples show how to use org.apache.tez.dag.api.client.DAGClient#waitForCompletion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestTaskErrorsUsingLocalMode.java    From tez with Apache License 2.0 6 votes vote down vote up
@Test(timeout = 20000)
public void testNonFatalErrorReported() throws IOException, TezException, InterruptedException {

  TezClient tezClient = getTezClient("testNonFatalErrorReported");
  DAGClient dagClient = null;

  try {
    FailingProcessor.configureForNonFatalFail();
    DAG dag = DAG.create("testNonFatalErrorReported").addVertex(
        Vertex
            .create(VERTEX_NAME, ProcessorDescriptor.create(FailingProcessor.class.getName()), 1));

    dagClient = tezClient.submitDAG(dag);
    dagClient.waitForCompletion();
    assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
    assertEquals(4, dagClient.getVertexStatus(VERTEX_NAME, null).getProgress().getFailedTaskAttemptCount());
  } finally {
    if (dagClient != null) {
      dagClient.close();
    }
    tezClient.stop();
  }
}
 
Example 2
Source File: TestLocalMode.java    From tez with Apache License 2.0 6 votes vote down vote up
@Test(timeout = 20000)
public void testNoSysExitOnSuccessfulDAG() throws TezException, InterruptedException,
    IOException {
  TezConfiguration tezConf1 = createConf();
  // Run in non-session mode so that the AM terminates
  TezClient tezClient1 = TezClient.create("commonName", tezConf1, false);
  tezClient1.start();

  DAG dag1 = createSimpleDAG("dag1", SleepProcessor.class.getName());

  DAGClient dagClient1 = tezClient1.submitDAG(dag1);
  dagClient1.waitForCompletion();
  assertEquals(DAGStatus.State.SUCCEEDED, dagClient1.getDAGStatus(null).getState());

  // Sleep for more time than is required for the DAG to complete.
  Thread.sleep((long) (TezConstants.TEZ_DAG_SLEEP_TIME_BEFORE_EXIT * 1.5));

  dagClient1.close();
  tezClient1.stop();
}
 
Example 3
Source File: TestMemoryWithEvents.java    From tez with Apache License 2.0 6 votes vote down vote up
private void testMemory(DAG dag, boolean sendDMEvents) throws Exception {
  StopWatch stopwatch = new StopWatch();
  stopwatch.start();
  TezConfiguration tezconf = new TezConfiguration(defaultConf);

  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null,
      null, false, false, numThreads, 1000);
  tezClient.start();
  
  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  mockApp.eventsDelegate = new TestMockDAGAppMaster.TestEventsDelegate();
  mockApp.doSleep = false;
  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  mockLauncher.startScheduling(true);
  DAGStatus status = dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, status.getState());
  checkMemory(dag.getName(), mockApp);
  stopwatch.stop();
  System.out.println("Time taken(ms): " + stopwatch.now(TimeUnit.MILLISECONDS));
  tezClient.stop();
}
 
Example 4
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test (timeout = 5000)
public void testInternalPreemption() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null);
  tezClient.start();
  
  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  // there is only 1 task whose first attempt will be preempted
  DAG dag = DAG.create("testInternalPreemption");
  Vertex vA = Vertex.create("A", ProcessorDescriptor.create("Proc.class"), 1);
  dag.addVertex(vA);

  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  ContainerData cData = mockLauncher.getContainers().values().iterator().next();
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  mockApp.getTaskSchedulerManager().preemptContainer(0, cData.cId);
  
  mockLauncher.startScheduling(true);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  TezVertexID vertexId = TezVertexID.getInstance(dagImpl.getID(), 0);
  TezTaskAttemptID killedTaId = TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), 0);
  TaskAttempt killedTa = dagImpl.getVertex(vA.getName()).getTask(0).getAttempt(killedTaId);
  //Refer to TEZ-3950
  Assert.assertTrue(killedTa.getState().equals(TaskAttemptState.KILLED) || killedTa.getState().equals(TaskAttemptState.FAILED));
  tezClient.stop();
}
 
Example 5
Source File: TestTezJobs.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 60000)
public void testInputInitializerEvents() throws TezException, InterruptedException, IOException {

  TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig());
  TezClient tezClient = TezClient.create("TestInputInitializerEvents", tezConf);
  tezClient.start();

  try {
    DAG dag = DAG.create("TestInputInitializerEvents");
    Vertex vertex1 = Vertex.create(VERTEX_WITH_INITIALIZER_NAME, ProcessorDescriptor.create(
        SleepProcessor.class.getName())
        .setUserPayload(new SleepProcessor.SleepProcessorConfig(1).toUserPayload()), 1)
        .addDataSource(INPUT1_NAME,
            DataSourceDescriptor
                .create(InputDescriptor.create(MultiAttemptDAG.NoOpInput.class.getName()),
                    InputInitializerDescriptor.create(InputInitializerForTest.class.getName()),
                    null));
    Vertex vertex2 = Vertex.create(EVENT_GENERATING_VERTEX_NAME,
        ProcessorDescriptor.create(InputInitializerEventGeneratingProcessor.class.getName()), 5);

    dag.addVertex(vertex1).addVertex(vertex2);

    DAGClient dagClient = tezClient.submitDAG(dag);
    dagClient.waitForCompletion();
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  } finally {
    tezClient.stop();
  }
}
 
Example 6
Source File: TestTezJobs.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 60000)
public void testVertexFailuresMaxPercent() throws TezException, InterruptedException, IOException {

  TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig());
  tezConf.set(TezConfiguration.TEZ_VERTEX_FAILURES_MAXPERCENT, "50.0f");
  tezConf.setInt(TezConfiguration.TEZ_AM_TASK_MAX_FAILED_ATTEMPTS, 1);
  TezClient tezClient = TezClient.create("TestVertexFailuresMaxPercent", tezConf);
  tezClient.start();

  try {
    DAG dag = DAG.create("TestVertexFailuresMaxPercent");
    Vertex vertex1 = Vertex.create("Parent", ProcessorDescriptor.create(
        FailingAttemptProcessor.class.getName()), 2);
    Vertex vertex2 = Vertex.create("Child", ProcessorDescriptor.create(FailingAttemptProcessor.class.getName()), 2);

    OrderedPartitionedKVEdgeConfig edgeConfig = OrderedPartitionedKVEdgeConfig
        .newBuilder(Text.class.getName(), IntWritable.class.getName(),
            HashPartitioner.class.getName())
        .setFromConfiguration(tezConf)
        .build();
    dag.addVertex(vertex1)
        .addVertex(vertex2)
        .addEdge(Edge.create(vertex1, vertex2, edgeConfig.createDefaultEdgeProperty()));

    DAGClient dagClient = tezClient.submitDAG(dag);
    dagClient.waitForCompletion();
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  } finally {
    tezClient.stop();
  }
}
 
Example 7
Source File: TestExternalTezServices.java    From tez with Apache License 2.0 5 votes vote down vote up
private void runExceptionSimulation() throws IOException, TezException, InterruptedException {
  DAG dag = DAG.create(ContainerRunnerImpl.DAG_NAME_INSTRUMENTED_FAILURES);
  Vertex v =Vertex.create("Vertex1", ProcessorDescriptor.create(SleepProcessor.class.getName()),
      3);
  v.setExecutionContext(EXECUTION_CONTEXT_EXT_SERVICE_PUSH);
  dag.addVertex(v);

  DAGClient dagClient = extServiceTestHelper.getSharedTezClient().submitDAG(dag);
  DAGStatus dagStatus = dagClient.waitForCompletion();
  assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState());
  assertEquals(1, dagStatus.getDAGProgress().getFailedTaskAttemptCount());
  assertEquals(1, dagStatus.getDAGProgress().getRejectedTaskAttemptCount());

}
 
Example 8
Source File: TestPreemption.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test (timeout = 5000)
public void testPreemptionWithoutSession() throws Exception {
  System.out.println("TestPreemptionWithoutSession");
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  tezconf.setInt(TezConfiguration.TEZ_AM_TASK_MAX_FAILED_ATTEMPTS, 0);
  AtomicBoolean mockAppLauncherGoFlag = new AtomicBoolean(false);
  MockTezClient tezClient = new MockTezClient("testPreemption", tezconf, false, null, null,
      null, mockAppLauncherGoFlag, false, false, 2, 2);
  tezClient.start();
  
  DAGClient dagClient = tezClient.submitDAG(createDAG(DataMovementType.SCATTER_GATHER));
  // now the MockApp has been started. sync with it to get the launcher
  syncWithMockAppLauncher(false, mockAppLauncherGoFlag, tezClient);

  DAGImpl dagImpl;
  do {
    Thread.sleep(100); // usually needs to sleep 2-3 times
  } while ((dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG()) == null);

  int vertexIndex = 0;
  int upToTaskVersion = 3;
  TezVertexID vertexId = TezVertexID.getInstance(dagImpl.getID(), vertexIndex);
  TezTaskAttemptID taId = TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), 0);

  mockLauncher.preemptContainerForTask(taId.getTaskID(), upToTaskVersion);
  mockLauncher.startScheduling(true);
  
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());

  for (int i=0; i<=upToTaskVersion; ++i) {
    TezTaskAttemptID testTaId = TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), i);      
    TaskAttemptImpl taImpl = dagImpl.getTaskAttempt(testTaId);
    Assert.assertEquals(TaskAttemptStateInternal.KILLED, taImpl.getInternalState());
  }
  
  tezClient.stop();
}
 
Example 9
Source File: TestLocalMode.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 30000)
public void testMultipleClientsWithSession() throws TezException, InterruptedException,
    IOException {
  TezConfiguration tezConf1 = createConf();
  TezClient tezClient1 = TezClient.create("commonName", tezConf1, true);
  tezClient1.start();

  DAG dag1 = createSimpleDAG("dag1", SleepProcessor.class.getName());

  DAGClient dagClient1 = tezClient1.submitDAG(dag1);
  dagClient1.waitForCompletion();
  assertEquals(DAGStatus.State.SUCCEEDED, dagClient1.getDAGStatus(null).getState());

  dagClient1.close();
  tezClient1.stop();

  TezConfiguration tezConf2 = createConf();
  DAG dag2 = createSimpleDAG("dag2", SleepProcessor.class.getName());
  TezClient tezClient2 = TezClient.create("commonName", tezConf2, true);
  tezClient2.start();
  DAGClient dagClient2 = tezClient2.submitDAG(dag2);
  dagClient2.waitForCompletion();
  assertEquals(DAGStatus.State.SUCCEEDED, dagClient2.getDAGStatus(null).getState());
  assertFalse(dagClient1.getExecutionContext().equals(dagClient2.getExecutionContext()));
  dagClient2.close();
  tezClient2.stop();
}
 
Example 10
Source File: TestLocalMode.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 10000)
public void testMultipleClientsWithoutSession() throws TezException, InterruptedException,
    IOException {
  TezConfiguration tezConf1 = createConf();
  TezClient tezClient1 = TezClient.create("commonName", tezConf1, false);
  tezClient1.start();

  DAG dag1 = createSimpleDAG("dag1", SleepProcessor.class.getName());

  DAGClient dagClient1 = tezClient1.submitDAG(dag1);
  dagClient1.waitForCompletion();
  assertEquals(DAGStatus.State.SUCCEEDED, dagClient1.getDAGStatus(null).getState());

  dagClient1.close();
  tezClient1.stop();


  TezConfiguration tezConf2 = createConf();
  DAG dag2 = createSimpleDAG("dag2", SleepProcessor.class.getName());
  TezClient tezClient2 = TezClient.create("commonName", tezConf2, false);
  tezClient2.start();
  DAGClient dagClient2 = tezClient2.submitDAG(dag2);
  dagClient2.waitForCompletion();
  assertEquals(DAGStatus.State.SUCCEEDED, dagClient2.getDAGStatus(null).getState());
  assertFalse(dagClient1.getExecutionContext().equals(dagClient2.getExecutionContext()));
  dagClient2.close();
  tezClient2.stop();
}
 
Example 11
Source File: TestSpeculation.java    From tez with Apache License 2.0 5 votes vote down vote up
/**
 * Test basic speculation not useful.
 *
 * @throws Exception the exception
 */
@Retry
@Test (timeout=10000)
public void testBasicSpeculationNotUseful() throws Exception {
  DAG dag = DAG.create("test");
  Vertex vA = Vertex.create("A", ProcessorDescriptor.create("Proc.class"), 5);
  dag.addVertex(vA);

  MockTezClient tezClient = createTezSession();
  
  DAGClient dagClient = tezClient.submitDAG(dag);
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  TezVertexID vertexId = TezVertexID.getInstance(dagImpl.getID(), 0);
  // original attempt is successful and speculative one is killed
  TezTaskAttemptID successTaId = TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), 0);
  TezTaskAttemptID killedTaId = TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), 1);

  mockLauncher.setStatusUpdatesForTask(successTaId, 100);
  mockLauncher.setStatusUpdatesForTask(killedTaId, 100);

  mockLauncher.startScheduling(true);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  Task task = dagImpl.getTask(killedTaId.getTaskID());
  Assert.assertEquals(2, task.getAttempts().size());
  Assert.assertEquals(successTaId, task.getSuccessfulAttempt().getID());
  TaskAttempt killedAttempt = task.getAttempt(killedTaId);
  Joiner.on(",").join(killedAttempt.getDiagnostics()).contains("Killed speculative attempt as");
  Assert.assertEquals(TaskAttemptTerminationCause.TERMINATED_INEFFECTIVE_SPECULATION, 
      killedAttempt.getTerminationCause());
  Assert.assertEquals(1, task.getCounters().findCounter(TaskCounter.NUM_SPECULATIONS)
      .getValue());
  Assert.assertEquals(1, dagImpl.getAllCounters().findCounter(TaskCounter.NUM_SPECULATIONS)
      .getValue());
  org.apache.tez.dag.app.dag.Vertex v = dagImpl.getVertex(killedTaId.getTaskID().getVertexID());
  Assert.assertEquals(1, v.getAllCounters().findCounter(TaskCounter.NUM_SPECULATIONS)
      .getValue());
  tezClient.stop();
}
 
Example 12
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 5000)
public void testDAGFinishedRecoveryError() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);

  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null);
  tezClient.start();

  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  mockApp.recoveryFatalError = true;
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(true);

  DAG dag = DAG.create("test");
  Vertex vA = Vertex.create("A", ProcessorDescriptor.create("Proc.class"), 5);
  dag.addVertex(vA);

  DAGClient dagClient = tezClient.submitDAG(dag);
  dagClient.waitForCompletion();
  while(!mockApp.getShutdownHandler().wasShutdownInvoked()) {
    Thread.sleep(100);
  }
  Assert.assertEquals(DAGState.SUCCEEDED, mockApp.getContext().getCurrentDAG().getState());
  Assert.assertEquals(DAGAppMasterState.FAILED, mockApp.getState());
  Assert.assertTrue(StringUtils.join(mockApp.getDiagnostics(),",")
      .contains("Recovery had a fatal error, shutting down session after" +
            " DAG completion"));
}
 
Example 13
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Test (timeout = 5000)
public void testBasicEvents() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null);
  tezClient.start();
  
  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  mockApp.eventsDelegate = new TestEventsDelegate();
  DAG dag = DAG.create("testBasicEvents");
  Vertex vA = Vertex.create("A", ProcessorDescriptor.create("Proc.class"), 2);
  Vertex vB = Vertex.create("B", ProcessorDescriptor.create("Proc.class"), 2);
  Vertex vC = Vertex.create("C", ProcessorDescriptor.create("Proc.class"), 2);
  Vertex vD = Vertex.create("D", ProcessorDescriptor.create("Proc.class"), 2);
  dag.addVertex(vA)
      .addVertex(vB)
      .addVertex(vC)
      .addVertex(vD)
      .addEdge(
          Edge.create(vA, vB, EdgeProperty.create(DataMovementType.BROADCAST,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))))
      .addEdge(
          Edge.create(vA, vC, EdgeProperty.create(DataMovementType.SCATTER_GATHER,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))))
      .addEdge(
          Edge.create(vA, vD, EdgeProperty.create(DataMovementType.ONE_TO_ONE,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))));

  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  mockLauncher.startScheduling(true);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  VertexImpl vImpl = (VertexImpl) dagImpl.getVertex(vB.getName());
  TaskImpl tImpl = (TaskImpl) vImpl.getTask(1);
  TezTaskAttemptID taId = TezTaskAttemptID.getInstance(tImpl.getTaskId(), 0);
  List<TezEvent> tEvents = vImpl.getTaskAttemptTezEvents(taId, 0, 0, 1000).getEvents();
  Assert.assertEquals(2, tEvents.size()); // 2 from vA
  Assert.assertEquals(vA.getName(), tEvents.get(0).getDestinationInfo().getEdgeVertexName());
  Assert.assertEquals(0, ((DataMovementEvent)tEvents.get(0).getEvent()).getSourceIndex());
  Assert.assertEquals(vA.getName(), tEvents.get(1).getDestinationInfo().getEdgeVertexName());
  Assert.assertEquals(0, ((DataMovementEvent)tEvents.get(1).getEvent()).getSourceIndex());
  int targetIndex1 = ((DataMovementEvent)tEvents.get(0).getEvent()).getTargetIndex();
  int targetIndex2 = ((DataMovementEvent)tEvents.get(1).getEvent()).getTargetIndex();
  // order of vA task completion can change order of events
  Assert.assertTrue("t1: " + targetIndex1 + " t2: " + targetIndex2,
      (targetIndex1 == 0 && targetIndex2 == 1) || (targetIndex1 == 1 && targetIndex2 == 0));
  vImpl = (VertexImpl) dagImpl.getVertex(vC.getName());
  tImpl = (TaskImpl) vImpl.getTask(1);
  taId = TezTaskAttemptID.getInstance(tImpl.getTaskId(), 0);
  tEvents = vImpl.getTaskAttemptTezEvents(taId, 0, 0, 1000).getEvents();
  Assert.assertEquals(2, tEvents.size()); // 2 from vA
  Assert.assertEquals(vA.getName(), tEvents.get(0).getDestinationInfo().getEdgeVertexName());
  Assert.assertEquals(1, ((CompositeRoutedDataMovementEvent)tEvents.get(0).getEvent()).getSourceIndex());
  Assert.assertEquals(vA.getName(), tEvents.get(1).getDestinationInfo().getEdgeVertexName());
  Assert.assertEquals(1, ((CompositeRoutedDataMovementEvent)tEvents.get(1).getEvent()).getSourceIndex());
  targetIndex1 = ((CompositeRoutedDataMovementEvent)tEvents.get(0).getEvent()).getTargetIndex();
  targetIndex2 = ((CompositeRoutedDataMovementEvent)tEvents.get(1).getEvent()).getTargetIndex();
  // order of vA task completion can change order of events
  Assert.assertTrue("t1: " + targetIndex1 + " t2: " + targetIndex2,
      (targetIndex1 == 0 && targetIndex2 == 1) || (targetIndex1 == 1 && targetIndex2 == 0));
  vImpl = (VertexImpl) dagImpl.getVertex(vD.getName());
  tImpl = (TaskImpl) vImpl.getTask(1);
  taId = TezTaskAttemptID.getInstance(tImpl.getTaskId(), 0);
  tEvents = vImpl.getTaskAttemptTezEvents(taId, 0, 0, 1000).getEvents();
  Assert.assertEquals(1, tEvents.size()); // 1 from vA
  Assert.assertEquals(vA.getName(), tEvents.get(0).getDestinationInfo().getEdgeVertexName());
  Assert.assertEquals(0, ((DataMovementEvent)tEvents.get(0).getEvent()).getTargetIndex());
  Assert.assertEquals(0, ((DataMovementEvent)tEvents.get(0).getEvent()).getSourceIndex());

  tezClient.stop();
}
 
Example 14
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Test (timeout = 100000)
public void testMixedEdgeRouting() throws Exception {
 TezConfiguration tezconf = new TezConfiguration(defaultConf);
  
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null);
  tezClient.start();
  
  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  mockApp.eventsDelegate = new TestEventsDelegate();
  DAG dag = DAG.create("testMixedEdgeRouting");
  Vertex vA = Vertex.create("A", ProcessorDescriptor.create("Proc.class"), 1);
  Vertex vB = Vertex.create("B", ProcessorDescriptor.create("Proc.class"), 1);
  Vertex vC = Vertex.create("C", ProcessorDescriptor.create("Proc.class"), 1);
  Vertex vD = Vertex.create("D", ProcessorDescriptor.create("Proc.class"), 1);
  Vertex vE = Vertex.create("E", ProcessorDescriptor.create("Proc.class"), 1);
  dag.addVertex(vA)
      .addVertex(vB)
      .addVertex(vC)
      .addVertex(vD)
      .addVertex(vE)
      .addEdge(
          Edge.create(vA, vC, EdgeProperty.create(DataMovementType.SCATTER_GATHER,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))))
      .addEdge(
          Edge.create(vB, vC, EdgeProperty.create(DataMovementType.SCATTER_GATHER,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))))
      .addEdge(
          Edge.create(vA, vD, EdgeProperty.create(DataMovementType.SCATTER_GATHER,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))))
      .addEdge(
          Edge.create(vB, vD, EdgeProperty.create(
              EdgeManagerPluginDescriptor.create(LegacyEdgeTestEdgeManager.class.getName()),
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))))
      .addEdge(
          Edge.create(vB, vE, EdgeProperty.create(
            EdgeManagerPluginDescriptor.create(LegacyEdgeTestEdgeManager.class.getName()),
            DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
            OutputDescriptor.create("Out"), InputDescriptor.create("In"))));

  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  mockLauncher.startScheduling(true);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  // vC uses on demand routing and its task does not provide events
  VertexImpl vImpl = (VertexImpl) dagImpl.getVertex(vC.getName());
  TaskImpl tImpl = (TaskImpl) vImpl.getTask(0);
  TezTaskAttemptID taId = TezTaskAttemptID.getInstance(tImpl.getTaskId(), 0);
  Assert.assertEquals(0, tImpl.getTaskAttemptTezEvents(taId, 0, 1000).size());
  // vD is mixed mode and only 1 out of 2 edges does legacy routing with task providing events
  vImpl = (VertexImpl) dagImpl.getVertex(vD.getName());
  tImpl = (TaskImpl) vImpl.getTask(0);
  taId = TezTaskAttemptID.getInstance(tImpl.getTaskId(), 0);
  Assert.assertEquals(1, tImpl.getTaskAttemptTezEvents(taId, 0, 1000).size());
  // vE has single legacy edge and does not use on demand routing and its task provides events
  vImpl = (VertexImpl) dagImpl.getVertex(vE.getName());
  tImpl = (TaskImpl) vImpl.getTask(0);
  taId = TezTaskAttemptID.getInstance(tImpl.getTaskId(), 0);
  Assert.assertEquals(1, tImpl.getTaskAttemptTezEvents(taId, 0, 1000).size());

  tezClient.stop();
}
 
Example 15
Source File: TestSpeculation.java    From tez with Apache License 2.0 4 votes vote down vote up
/**
 * Test single task speculation.
 *
 * @throws Exception the exception
 */
@Retry
@Test (timeout = 10000)
public void testSingleTaskSpeculation() throws Exception {
  // Map<Timeout conf value, expected number of tasks>
  Map<Long, Integer> confToExpected = new HashMap<Long, Integer>();
  confToExpected.put(Long.MAX_VALUE >> 1, 1); // Really long time to speculate
  confToExpected.put(100L, 2);
  confToExpected.put(-1L, 1); // Don't speculate
  defaultConf.setLong(TezConfiguration.TEZ_AM_SOONEST_RETRY_AFTER_NO_SPECULATE, 50);
  for(Map.Entry<Long, Integer> entry : confToExpected.entrySet()) {
    defaultConf.setLong(
            TezConfiguration.TEZ_AM_LEGACY_SPECULATIVE_SINGLE_TASK_VERTEX_TIMEOUT,
            entry.getKey());

    DAG dag = DAG.create("test");
    Vertex vA = Vertex.create("A",
            ProcessorDescriptor.create("Proc.class"),
            1);
    dag.addVertex(vA);

    MockTezClient tezClient = createTezSession();

    DAGClient dagClient = tezClient.submitDAG(dag);
    DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
    TezVertexID vertexId = TezVertexID.getInstance(dagImpl.getID(), 0);
    // original attempt is killed and speculative one is successful
    TezTaskAttemptID killedTaId =
        TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), 0);
    TezTaskAttemptID successTaId =
        TezTaskAttemptID.getInstance(TezTaskID.getInstance(vertexId, 0), 1);
    Thread.sleep(200);
    // cause speculation trigger
    mockLauncher.setStatusUpdatesForTask(killedTaId, 100);

    mockLauncher.startScheduling(true);
    dagClient.waitForCompletion();
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
    Task task = dagImpl.getTask(killedTaId.getTaskID());
    Assert.assertEquals(entry.getValue().intValue(), task.getAttempts().size());
    if (entry.getValue() > 1) {
      Assert.assertEquals(successTaId, task.getSuccessfulAttempt().getID());
      TaskAttempt killedAttempt = task.getAttempt(killedTaId);
      Joiner.on(",").join(killedAttempt.getDiagnostics()).contains("Killed as speculative attempt");
      Assert.assertEquals(TaskAttemptTerminationCause.TERMINATED_EFFECTIVE_SPECULATION,
              killedAttempt.getTerminationCause());
    }
    tezClient.stop();
  }
}
 
Example 16
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Test (timeout = 60000)
public void testCommitOutputOnVertexSuccess() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  tezconf.setBoolean(TezConfiguration.TEZ_AM_COMMIT_ALL_OUTPUTS_ON_DAG_SUCCESS, false);
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null);
  tezClient.start();

  // both committers succeed
  DAG dag1 = createDAG("testDAGBothCommitsSucceed", false, false);
  DAGClient dagClient = tezClient.submitDAG(dag1);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  
  // vertexGroupCommiter fail (uv12)
  DAG dag2 = createDAG("testDAGVertexGroupCommitFail", true, false);
  dagClient = tezClient.submitDAG(dag2);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  LOG.info(dagClient.getDAGStatus(null).getDiagnostics());
  Assert.assertTrue(StringUtils.join(dagClient.getDAGStatus(null).getDiagnostics(),",")
      .contains("fail output committer:uv12Out"));
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v1", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v2", null).getState());
  VertexStatus.State v3State = dagClient.getVertexStatus("v3", null).getState();
  // v3 either succeeded (commit completed before uv12 commit fails)
  // or killed ( uv12 commit fail when v3 is in running/committing)
  if (v3State.equals(VertexStatus.State.SUCCEEDED)) {
    LOG.info("v3 is succeeded");
  } else {
    Assert.assertEquals(VertexStatus.State.KILLED, v3State);
  }

  // vertex commit fail (v3)
  DAG dag3 = createDAG("testDAGVertexCommitFail", false, true);
  dagClient = tezClient.submitDAG(dag3);
  dagClient.waitForCompletion();
  LOG.info(dagClient.getDAGStatus(null).getDiagnostics());
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  Assert.assertTrue(StringUtils.join(dagClient.getDAGStatus(null).getDiagnostics(),",")
      .contains("Commit failed"));
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v1", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v2", null).getState());
  Assert.assertEquals(VertexStatus.State.FAILED, dagClient.getVertexStatus("v3", null).getState());
  Assert.assertTrue(StringUtils.join(dagClient.getVertexStatus("v3", null).getDiagnostics(),",")
      .contains("fail output committer:v3Out"));
  
  // both committers fail
  DAG dag4 = createDAG("testDAGBothCommitsFail", true, true);
  dagClient = tezClient.submitDAG(dag4);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  LOG.info(dagClient.getDAGStatus(null).getDiagnostics());
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  String diag = StringUtils.join(dagClient.getDAGStatus(null).getDiagnostics(),",");
  Assert.assertTrue(diag.contains("fail output committer:uv12Out") ||
      diag.contains("fail output committer:v3Out"));
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v1", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v2", null).getState());
  v3State = dagClient.getVertexStatus("v3", null).getState();
  // v3 either failed (commit of v3 fail before uv12 commit)
  // or killed ( uv12 commit fail before commit of v3)
  if (v3State.equals(VertexStatus.State.FAILED)) {
    LOG.info("v3 is failed");
    Assert.assertTrue(StringUtils.join(dagClient.getVertexStatus("v3", null).getDiagnostics(),",")
        .contains("fail output committer:v3Out"));
  } else {
    Assert.assertEquals(VertexStatus.State.KILLED, v3State);
  }

  tezClient.stop();
}
 
Example 17
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Test (timeout = 10000)
public void testBasicStatistics() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null,
      null, false, false);
  tezClient.start();

  final String vAName = "A";
  final String vBName = "B";
  final String sourceName = "In";
  final String sinkName = "Out";
  DAG dag = DAG.create("testBasisStatistics");
  Vertex vA = Vertex.create(vAName, ProcessorDescriptor.create("Proc.class"), 3);
  Vertex vB = Vertex.create(vBName, ProcessorDescriptor.create("Proc.class"), 2);
  vA.addDataSource(sourceName,
      DataSourceDescriptor.create(InputDescriptor.create("In"), null, null));
  vB.addDataSink(sinkName, DataSinkDescriptor.create(OutputDescriptor.create("Out"), null, null));
  dag.addVertex(vA)
      .addVertex(vB)
      .addEdge(
          Edge.create(vA, vB, EdgeProperty.create(DataMovementType.SCATTER_GATHER,
              DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
              OutputDescriptor.create("Out"), InputDescriptor.create("In"))));
  IOStatistics ioStats = new IOStatistics();
  ioStats.setDataSize(1);
  ioStats.setItemsProcessed(1);
  TaskStatistics vAStats = new TaskStatistics();
  vAStats.addIO(vBName, ioStats);
  vAStats.addIO(sourceName, ioStats);
  TaskStatistics vBStats = new TaskStatistics();
  vBStats.addIO(vAName, ioStats);
  vBStats.addIO(sinkName, ioStats);
  ByteArrayOutputStream bosA = new ByteArrayOutputStream();
  DataOutput outA = new DataOutputStream(bosA);
  vAStats.write(outA);
  final byte[] payloadA = bosA.toByteArray();
  ByteArrayOutputStream bosB = new ByteArrayOutputStream();
  DataOutput outB = new DataOutputStream(bosB);
  vBStats.write(outB);
  final byte[] payloadB = bosB.toByteArray();
  
  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  mockApp.statsDelegate = new StatisticsDelegate() {
    @Override
    public TaskStatistics getStatistics(TaskSpec taskSpec) {
      byte[] payload = payloadA;
      TaskStatistics stats = new TaskStatistics();
      if (taskSpec.getVertexName().equals(vBName)) {
        payload = payloadB;
      }
      final DataInputByteBuffer in = new DataInputByteBuffer();
      in.reset(ByteBuffer.wrap(payload));
      try {
        // this ensures that the serde code path is covered.
        stats.readFields(in);
      } catch (IOException e) {
        Assert.fail(e.getMessage());
      }
      return stats;
    }
  };
  mockApp.doSleep = false;
  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  mockLauncher.startScheduling(true);
  DAGStatus status = dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, status.getState());
  
  // verify that the values have been correct aggregated
  for (org.apache.tez.dag.app.dag.Vertex v : dagImpl.getVertices().values()) {
    VertexStatistics vStats = v.getStatistics();
    if (v.getName().equals(vAName)) {
      Assert.assertEquals(3, vStats.getOutputStatistics(vBName).getDataSize());
      Assert.assertEquals(3, vStats.getInputStatistics(sourceName).getDataSize());
      Assert.assertEquals(3, vStats.getOutputStatistics(vBName).getItemsProcessed());
      Assert.assertEquals(3, vStats.getInputStatistics(sourceName).getItemsProcessed());
    } else {
      Assert.assertEquals(2, vStats.getInputStatistics(vAName).getDataSize());
      Assert.assertEquals(2, vStats.getOutputStatistics(sinkName).getDataSize());
      Assert.assertEquals(2, vStats.getInputStatistics(vAName).getItemsProcessed());
      Assert.assertEquals(2, vStats.getOutputStatistics(sinkName).getItemsProcessed());
    }
  }
  
  tezClient.stop();
}
 
Example 18
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Ignore
@Test (timeout = 60000)
public void testBasicStatisticsMemory() throws Exception {
  Logger.getRootLogger().setLevel(Level.WARN);
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null,
      null, false, false);
  tezClient.start();

  final String vAName = "abcdefghijklmnopqrstuvwxyz";
  int numTasks = 10000;
  int numSources = 10;

  IOStatistics ioStats = new IOStatistics();
  ioStats.setDataSize(1);
  ioStats.setItemsProcessed(1);
  TaskStatistics vAStats = new TaskStatistics();

  DAG dag = DAG.create("testBasicStatisticsMemory");
  Vertex vA = Vertex.create(vAName, ProcessorDescriptor.create("Proc.class"), numTasks);
  for (int i=0; i<numSources; ++i) {
    final String sourceName = i + vAName;
    vA.addDataSource(sourceName,
        DataSourceDescriptor.create(InputDescriptor.create(sourceName), null, null));
    vAStats.addIO(sourceName, ioStats);
  }
  dag.addVertex(vA);

  ByteArrayOutputStream bosA = new ByteArrayOutputStream();
  DataOutput outA = new DataOutputStream(bosA);
  vAStats.write(outA);
  final byte[] payloadA = bosA.toByteArray();
  
  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  mockApp.statsDelegate = new StatisticsDelegate() {
    @Override
    public TaskStatistics getStatistics(TaskSpec taskSpec) {
      byte[] payload = payloadA;
      TaskStatistics stats = new TaskStatistics();
      final DataInputByteBuffer in = new DataInputByteBuffer();
      in.reset(ByteBuffer.wrap(payload));
      try {
        // this ensures that the serde code path is covered.
        stats.readFields(in);
      } catch (IOException e) {
        Assert.fail(e.getMessage());
      }
      return stats;
    }
  };
  mockApp.doSleep = false;
  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  mockLauncher.startScheduling(true);
  DAGStatus status = dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, status.getState());
  Assert.assertEquals(numTasks,
      dagImpl.getVertex(vAName).getStatistics().getInputStatistics(0+vAName).getDataSize());
  Assert.assertEquals(numTasks,
      dagImpl.getVertex(vAName).getStatistics().getInputStatistics(0+vAName).getItemsProcessed());
  checkMemory(dag.getName(), mockApp);
  tezClient.stop();
}
 
Example 19
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Test
public void testCountersAggregation() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null,
                                              null, false, false);
  tezClient.start();

  final String vAName = "A";
  final String vBName = "B";
  final String procCounterName = "Proc";
  final String globalCounterName = "Global";
  DAG dag = DAG.create("testCountersAggregation");
  Vertex vA = Vertex.create(vAName, ProcessorDescriptor.create("Proc.class"), 10);
  Vertex vB = Vertex.create(vBName, ProcessorDescriptor.create("Proc.class"), 1);
  dag.addVertex(vA)
      .addVertex(vB)
      .addEdge(
          Edge.create(vA, vB, EdgeProperty.create(DataMovementType.SCATTER_GATHER,
                                                  DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
                                                  OutputDescriptor.create("Out"), InputDescriptor.create("In"))));
  TezCounters temp = new TezCounters();
  temp.findCounter(new String(globalCounterName), new String(globalCounterName)).increment(1);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  DataOutput out = new DataOutputStream(bos);
  temp.write(out);
  final byte[] payload = bos.toByteArray();

  MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
  MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
  mockLauncher.startScheduling(false);
  mockApp.countersDelegate = new CountersDelegate() {
    int counterValue = 0;
    @Override
    public TezCounters getCounters(TaskSpec taskSpec) {
      String vName = taskSpec.getVertexName();
      TezCounters counters = new TezCounters();
      final DataInputByteBuffer in  = new DataInputByteBuffer();
      in.reset(ByteBuffer.wrap(payload));
      try {
        // this ensures that the serde code path is covered.
        // the internal merges of counters covers the constructor code path.
        counters.readFields(in);
      } catch (IOException e) {
        Assert.fail(e.getMessage());
      }
      counters.findCounter(vName, procCounterName).setValue(++counterValue);
      for (OutputSpec output : taskSpec.getOutputs()) {
        counters.findCounter(vName, output.getDestinationVertexName()).setValue(++counterValue);
      }
      for (InputSpec input : taskSpec.getInputs()) {
        counters.findCounter(vName, input.getSourceVertexName()).setValue(++counterValue);
      }
      return counters;
    }
  };
  mockApp.doSleep = false;
  DAGClient dagClient = tezClient.submitDAG(dag);
  mockLauncher.waitTillContainersLaunched();
  DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
  mockLauncher.startScheduling(true);
  DAGStatus status = dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, status.getState());
  TezCounters counters = dagImpl.getAllCounters();

  // verify processor counters
  VertexImpl vAImpl = (VertexImpl) dagImpl.getVertex(vAName);
  VertexImpl vBImpl = (VertexImpl) dagImpl.getVertex(vBName);
  TezCounters vACounters = vAImpl.getAllCounters();
  TezCounters vBCounters = vBImpl.getAllCounters();

  Assert.assertEquals(19, ((AggregateTezCounterDelegate)vACounters.findCounter(vAName, procCounterName)).getMax());
  Assert.assertEquals(1, ((AggregateTezCounterDelegate)vACounters.findCounter(vAName, procCounterName)).getMin());
  Assert.assertEquals(20, ((AggregateTezCounterDelegate)vACounters.findCounter(vAName, vBName)).getMax());
  Assert.assertEquals(2, ((AggregateTezCounterDelegate)vACounters.findCounter(vAName, vBName)).getMin());

  Assert.assertEquals(21, ((AggregateTezCounterDelegate)vBCounters.findCounter(vBName, procCounterName)).getMin());
  Assert.assertEquals(21, ((AggregateTezCounterDelegate)vBCounters.findCounter(vBName, procCounterName)).getMax());
  Assert.assertEquals(22, ((AggregateTezCounterDelegate)vBCounters.findCounter(vBName, vAName)).getMin());
  Assert.assertEquals(22, ((AggregateTezCounterDelegate)vBCounters.findCounter(vBName, vAName)).getMax());

  tezClient.stop();
}
 
Example 20
Source File: TestMockDAGAppMaster.java    From tez with Apache License 2.0 4 votes vote down vote up
@Test (timeout = 60000)
public void testCommitOutputOnDAGSuccess() throws Exception {
  TezConfiguration tezconf = new TezConfiguration(defaultConf);
  MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null);
  tezClient.start();

  // both committers succeed
  DAG dag1 = createDAG("testDAGBothCommitsSucceed", false, false);
  DAGClient dagClient = tezClient.submitDAG(dag1);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagClient.getDAGStatus(null).getState());
  
  // vertexGroupCommiter fail (uv12)
  DAG dag2 = createDAG("testDAGVertexGroupCommitFail", true, false);
  dagClient = tezClient.submitDAG(dag2);
  dagClient.waitForCompletion();
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  LOG.info(dagClient.getDAGStatus(null).getDiagnostics());
  Assert.assertTrue(StringUtils.join(dagClient.getDAGStatus(null).getDiagnostics(),",")
      .contains("fail output committer:uv12Out"));
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v1", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v2", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v3", null).getState());

  // vertex commit fail (v3)
  DAG dag3 = createDAG("testDAGVertexCommitFail", false, true);
  dagClient = tezClient.submitDAG(dag3);
  dagClient.waitForCompletion();
  LOG.info(dagClient.getDAGStatus(null).getDiagnostics());
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  Assert.assertTrue(StringUtils.join(dagClient.getDAGStatus(null).getDiagnostics(),",")
      .contains("fail output committer:v3Out"));
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v1", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v2", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v3", null).getState());

  // both committers fail
  DAG dag4 = createDAG("testDAGBothCommitsFail", true, true);
  dagClient = tezClient.submitDAG(dag4);
  dagClient.waitForCompletion();
  LOG.info(dagClient.getDAGStatus(null).getDiagnostics());
  Assert.assertEquals(DAGStatus.State.FAILED, dagClient.getDAGStatus(null).getState());
  String diag = StringUtils.join(dagClient.getDAGStatus(null).getDiagnostics(),",");
  Assert.assertTrue(diag.contains("fail output committer:uv12Out") ||
      diag.contains("fail output committer:v3Out"));
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v1", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v2", null).getState());
  Assert.assertEquals(VertexStatus.State.SUCCEEDED, dagClient.getVertexStatus("v3", null).getState());

  tezClient.stop();
}