public long getLastStageId() {
    return stages.isEmpty() ? -1 : stages.get(stages.size() - 1).getStageId();
  }
Get the stage id of the last stage.

@return stage id of the last stage or -1 if no stages present
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestStageContainer.java