code: private boolean isTaskRunning(TaskStatus taskStatus) {
      TaskStatus.State state = taskStatus.getRunState();
      return (state == State.RUNNING || state == State.UNASSIGNED || 
              taskStatus.inTaskCleanupPhase());
    }
docs: Is the given task considered as 'running' ?
  @param taskStatus
  @return