code: public String getUserName(TaskAttemptID taskId) {
      TaskInProgress tip = tasks.get(taskId);
      if (tip != null) {
        return tip.getJobConf().getUser();
      }
      return null;
    }
docs: Obtain username from TaskId
  @param taskId
  @return username