@Override
  public void killFragment(String fragmentId) {
    synchronized (lock) {
      TaskWrapper taskWrapper = knownTasks.remove(fragmentId);
      // Can be null since the task may have completed meanwhile.
      if (taskWrapper != null) {
        if (taskWrapper.isInWaitQueue()) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Removing {} from waitQueue", fragmentId);
          }
          taskWrapper.setIsInWaitQueue(false);
          taskWrapper.getTaskRunnerCallable().setWmCountersDone();
          if (waitQueue.remove(taskWrapper)) {
            metrics.setExecutorNumQueuedRequests(waitQueue.size());
          }
        }
        if (taskWrapper.isInPreemptionQueue()) {
          LOG.debug("Removing {} from preemptionQueue", fragmentId);
          removeFromPreemptionQueue(taskWrapper);
        }
        taskWrapper.getTaskRunnerCallable().setWmCountersDone();
        // TODO: this will probably send a message to AM. Is that needed here?
        taskWrapper.getTaskRunnerCallable().killTask();
      } else {
        LOG.info("Ignoring killFragment request for {} since it isn't known", fragmentId);
      }
      lock.notifyAll();
    }
  }
Worker that takes tasks from wait queue and schedule it for execution.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/TaskExecutorService.java