private synchronized void setStateOnDAGCompletion() {
   DAGAppMasterState oldState = state;
   if (isSession) {
     return;
   }
   switch (currentDAG.getState()) {
     case SUCCEEDED:
       state = DAGAppMasterState.SUCCEEDED;
       break;
     case FAILED:
       state = DAGAppMasterState.FAILED;
       break;
     case KILLED:
       state = DAGAppMasterState.KILLED;
       break;
     case ERROR:
       state = DAGAppMasterState.ERROR;
       break;
     default:
       state = DAGAppMasterState.ERROR;
       break;
   }
   LOG.info("On DAG completion. Old state: " + oldState + " new state: " + state);
 }
 public float getProgress() {
   if (currentDAG != null && currentDAG.getState() == DAGState.RUNNING) {
     return currentDAG.getProgress();
   }
   return 0;
 }