runDAGAndVerify(dag, finalState, tezSession);
}
void runDAGAndVerify(DAG dag, DAGStatus.State finalState,
TezSession session) throws Exception {
TezSessionStatus status = session.getSessionStatus();
while (status != TezSessionStatus.READY && status != TezSessionStatus.SHUTDOWN) {
LOG.info("Waiting for session to be ready. Current: " + status);
Thread.sleep(100);
status = session.getSessionStatus();
}