private boolean canFinish() {
    List<IOSpecProto> inputSpecList = vertexSpec.getInputSpecsList();
    boolean canFinish = true;
    if (inputSpecList != null && !inputSpecList.isEmpty()) {
      for (IOSpecProto inputSpec : inputSpecList) {
        if (LlapTezUtils.isSourceOfInterest(inputSpec.getIoDescriptor().getClassName())) {
          // Lookup the state in the map.
          LlapDaemonProtocolProtos.SourceStateProto state = queryInfo.getSourceStateMap()
              .get(inputSpec.getConnectedVertexName());
          if (state != null && state == LlapDaemonProtocolProtos.SourceStateProto.S_SUCCEEDED) {
            continue;
          } else {
            if (LOG.isDebugEnabled()) {
              LOG.debug("Cannot finish due to source: " + inputSpec.getConnectedVertexName());
            }
            canFinish = false;
            break;
          }
        }
      }
    }
    return canFinish;
  }
Check whether a task can run to completion or may end up blocking on it's sources.
This currently happens via looking up source state.
TODO: Eventually, this should lookup the Hive Processor to figure out whether
it's reached a state where it can finish - especially in cases of failures
after data has been fetched.

@return true if the task can finish, false otherwise
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/QueryFragmentInfo.java