DAG dag = createDAG(tezConf, inputPath, outputPath, numPartitions);
// check that the execution environment is ready
tezClient.waitTillReady();
// submit the dag and receive a dag client to monitor the progress
DAGClient dagClient = tezClient.submitDAG(dag);
// monitor the progress and wait for completion. This method blocks until the dag is done.
DAGStatus dagStatus = dagClient.waitForCompletionWithStatusUpdates(null);
// check success or failure and print diagnostics
if (dagStatus.getState() != DAGStatus.State.SUCCEEDED) {