private long getFirstJobOrderId(RequestExecution requestExecution) throws AmbariException {
    Long firstBatchOrderId = null;
    Batch batch = requestExecution.getBatch();
    if (batch != null) {
      List<BatchRequest> batchRequests = batch.getBatchRequests();
      if (batchRequests != null) {
        Collections.sort(batchRequests);
        ListIterator<BatchRequest> iterator = batchRequests.listIterator();
        firstBatchOrderId = iterator.next().getOrderId();
      }
    }
    if (firstBatchOrderId == null) {
      throw new AmbariException("Can't schedule RequestExecution with no batches");
    }
    return firstBatchOrderId;
  }
Find out by how much did a schedule misfire and decide whether to continue
based on configuration
@param jobExecutionContext
@return
ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionScheduleManager.java