Search in sources :

Example 11 with RecoveryService

use of org.apache.tez.dag.history.recovery.RecoveryService in project tez by apache.

the class TestRecoveryParser method testRecoverableSummary_VertexInCommitting.

@Test(timeout = 5000)
public void testRecoverableSummary_VertexInCommitting() throws IOException {
    ApplicationId appId = ApplicationId.newInstance(System.currentTimeMillis(), 1);
    TezDAGID dagID = TezDAGID.getInstance(appId, 1);
    AppContext appContext = mock(AppContext.class);
    when(appContext.getCurrentRecoveryDir()).thenReturn(new Path(recoveryPath + "/1"));
    when(appContext.getClock()).thenReturn(new SystemClock());
    when(mockDAGImpl.getID()).thenReturn(dagID);
    RecoveryService rService = new RecoveryService(appContext);
    Configuration conf = new Configuration();
    conf.setBoolean(RecoveryService.TEZ_TEST_RECOVERY_DRAIN_EVENTS_WHEN_STOPPED, true);
    rService.init(conf);
    rService.start();
    DAGPlan dagPlan = TestDAGImpl.createTestDAGPlan();
    // write a DAGSubmittedEvent first to initialize summaryStream
    rService.handle(new DAGHistoryEvent(dagID, new DAGSubmittedEvent(dagID, 1L, dagPlan, ApplicationAttemptId.newInstance(appId, 1), null, "user", new Configuration(), null, null)));
    // It should be fine to skip other events, just for testing.
    rService.handle(new DAGHistoryEvent(dagID, new VertexCommitStartedEvent(TezVertexID.getInstance(dagID, 0), 0L)));
    rService.stop();
    DAGRecoveryData dagData = parser.parseRecoveryData();
    assertEquals(dagID, dagData.recoveredDagID);
    assertTrue(dagData.nonRecoverable);
    assertTrue(dagData.reason.contains("Vertex Commit was in progress"));
}
Also used : Path(org.apache.hadoop.fs.Path) RecoveryService(org.apache.tez.dag.history.recovery.RecoveryService) DAGPlan(org.apache.tez.dag.api.records.DAGProtos.DAGPlan) SystemClock(org.apache.hadoop.yarn.util.SystemClock) Configuration(org.apache.hadoop.conf.Configuration) TezDAGID(org.apache.tez.dag.records.TezDAGID) DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) DAGRecoveryData(org.apache.tez.dag.app.RecoveryParser.DAGRecoveryData) DAGSubmittedEvent(org.apache.tez.dag.history.events.DAGSubmittedEvent) VertexCommitStartedEvent(org.apache.tez.dag.history.events.VertexCommitStartedEvent)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)11 Path (org.apache.hadoop.fs.Path)11 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)11 SystemClock (org.apache.hadoop.yarn.util.SystemClock)11 DAGPlan (org.apache.tez.dag.api.records.DAGProtos.DAGPlan)11 DAGHistoryEvent (org.apache.tez.dag.history.DAGHistoryEvent)11 DAGSubmittedEvent (org.apache.tez.dag.history.events.DAGSubmittedEvent)11 RecoveryService (org.apache.tez.dag.history.recovery.RecoveryService)11 TezDAGID (org.apache.tez.dag.records.TezDAGID)11 DAGRecoveryData (org.apache.tez.dag.app.RecoveryParser.DAGRecoveryData)10 DefaultHadoopShim (org.apache.tez.hadoop.shim.DefaultHadoopShim)5 DAGInitializedEvent (org.apache.tez.dag.history.events.DAGInitializedEvent)4 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)3 DAGCommitStartedEvent (org.apache.tez.dag.history.events.DAGCommitStartedEvent)3 DAGStartedEvent (org.apache.tez.dag.history.events.DAGStartedEvent)3 VertexFinishedEvent (org.apache.tez.dag.history.events.VertexFinishedEvent)3 TezVertexID (org.apache.tez.dag.records.TezVertexID)3 DAGFinishedEvent (org.apache.tez.dag.history.events.DAGFinishedEvent)2 VertexCommitStartedEvent (org.apache.tez.dag.history.events.VertexCommitStartedEvent)2 VertexGroupCommitStartedEvent (org.apache.tez.dag.history.events.VertexGroupCommitStartedEvent)2