private boolean findGuaranteedToReallocate(TaskInfo candidate, Ref<TaskInfo> toUpdate) {
    Iterator<Entry<Integer, TreeSet<TaskInfo>>> iterator =
        guaranteedTasks.descendingMap().entrySet().iterator();
    while (iterator.hasNext()) {
      Entry<Integer, TreeSet<TaskInfo>> entry = iterator.next();
      int priority = entry.getKey();
      TreeSet<TaskInfo> atPriority = entry.getValue();
      if (priority <= candidate.priority.getPriority()) {
        return false; // The tasks from now on are more important than the candidate.
      }
      TaskInfo taskInfo = atPriority.pollLast();
      if (taskInfo != null) {
        synchronized (taskInfo) {
          assert taskInfo.isGuaranteed;
          taskInfo.isGuaranteed = false;
          // See the comment in handleUpdateForSinglePriorityLevel.
          if (!taskInfo.isPendingUpdate) {
            setUpdateStartedUnderTiLock(taskInfo);
            toUpdate.value = taskInfo;
          }
        }
        addToRunningTasksMap(speculativeTasks, taskInfo);
      }
      // Remove entire priority level if it's been emptied.
      if (atPriority.isEmpty()) {
        iterator.remove();
      }
      if (taskInfo != null) {
        return true;
      }
    }
    return false;
  }
Go through the running tasks Tree in descending priority and find a candidate to preempt. The candidate should be:
1. lower priority than forTask
2. below forTask in the DAG
3. not considered already for preemption
A successful candidate is added to the preemptionCandidates queue for preemption by the scheduling loop.
@param runningTasks Tree of running tasks
@param forTask Task to find preemption candidate for
@param preemptHosts Hosts preference
@return true when preemption candidate is found
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/LlapTaskSchedulerService.java