Search in sources :

Example 1 with DAGSummaryData

use of org.apache.tez.dag.app.RecoveryParser.DAGSummaryData in project tez by apache.

the class TestRecoveryParser method testGetLastInProgressDAG.

@Test(timeout = 5000)
public void testGetLastInProgressDAG() {
    Map<TezDAGID, DAGSummaryData> summaryDataMap = new HashMap<TezDAGID, DAGSummaryData>();
    int dagNum = 20;
    int lastInProgressDAGId = new Random().nextInt(dagNum) + 1;
    for (int i = 1; i <= dagNum; ++i) {
        ApplicationId appId = ApplicationId.newInstance(1, 1);
        TezDAGID dagId = TezDAGID.getInstance(appId, i);
        if (i == lastInProgressDAGId) {
            summaryDataMap.put(dagId, createDAGSummaryData(dagId, false));
        } else {
            summaryDataMap.put(dagId, createDAGSummaryData(dagId, true));
        }
    }
    DAGSummaryData lastInProgressDAG = parser.getLastCompletedOrInProgressDAG(summaryDataMap);
    assertEquals(lastInProgressDAGId, lastInProgressDAG.dagId.getId());
}
Also used : Random(java.util.Random) HashMap(java.util.HashMap) TezDAGID(org.apache.tez.dag.records.TezDAGID) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) DAGSummaryData(org.apache.tez.dag.app.RecoveryParser.DAGSummaryData)

Example 2 with DAGSummaryData

use of org.apache.tez.dag.app.RecoveryParser.DAGSummaryData in project tez by apache.

the class TestRecoveryParser method testGetLastCompletedDAG.

@Test(timeout = 5000)
public void testGetLastCompletedDAG() {
    Map<TezDAGID, DAGSummaryData> summaryDataMap = new HashMap<TezDAGID, DAGSummaryData>();
    int lastCompletedDAGId = new Random().nextInt(20) + 1;
    for (int i = 1; i <= lastCompletedDAGId; ++i) {
        ApplicationId appId = ApplicationId.newInstance(1, 1);
        TezDAGID dagId = TezDAGID.getInstance(appId, i);
        summaryDataMap.put(dagId, createDAGSummaryData(dagId, true));
    }
    DAGSummaryData lastCompletedDAG = parser.getLastCompletedOrInProgressDAG(summaryDataMap);
    assertEquals(lastCompletedDAGId, lastCompletedDAG.dagId.getId());
}
Also used : Random(java.util.Random) HashMap(java.util.HashMap) TezDAGID(org.apache.tez.dag.records.TezDAGID) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) DAGSummaryData(org.apache.tez.dag.app.RecoveryParser.DAGSummaryData)

Example 3 with DAGSummaryData

use of org.apache.tez.dag.app.RecoveryParser.DAGSummaryData in project tez by apache.

the class TestRecoveryParser method createDAGSummaryData.

private DAGSummaryData createDAGSummaryData(TezDAGID dagId, boolean completed) {
    DAGSummaryData data = new DAGSummaryData(dagId);
    data.completed = completed;
    return data;
}
Also used : DAGSummaryData(org.apache.tez.dag.app.RecoveryParser.DAGSummaryData)

Aggregations

DAGSummaryData (org.apache.tez.dag.app.RecoveryParser.DAGSummaryData)3 HashMap (java.util.HashMap)2 Random (java.util.Random)2 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2 TezDAGID (org.apache.tez.dag.records.TezDAGID)2