public void getTaskDiagnostics(String job) {

    try {
      String errinfo[];
      StringBuilder sb = new StringBuilder();

      JobID jobid = JobID.forName(job);
      JobStatus status = client.getJobStatus(jobid);
      System.out.println(status.getTrackingUrl());
      System.out.println(status.getJobFile());
      System.out.println(status.getHistoryFile());
      System.out.println(status.getQueue());
      System.out.println(status.toString());

      System.out.println("#### QueueAclsInfo ####");
      QueueAclsInfo[] qais = client.getQueueAclsForCurrentUser();
      for (int i = 0; i < qais.length; i++) {
        QueueAclsInfo qai = qais[i];
        System.out.println(qai.getQueueName().toString());
        String[] ops = qai.getOperations();
        for (int j = 0; j < ops.length; j++) {
          System.out.println(ops[j]);
        }
      }

      System.out.println("#### QueueInfo ####");
      QueueInfo[] qis = client.getRootQueues();
      for (int i = 0; i < qis.length; i++) {
        QueueInfo qi = qis[i];
        System.out.println(qi.getQueueName());
        System.out.println(qi.getSchedulingInfo());
        System.out.println(qi.getState());
        System.out.println(qi.getProperties());
      }

      int mapnum = client.getTaskReports(jobid, TaskType.MAP).length;
      int rednum = client.getTaskReports(jobid, TaskType.REDUCE).length;
      float progress = status.getMapProgress();
      sb.append(
          String.format(
              "m %4d %6s",
              mapnum, progress == 1 ? "100%" : String.format("%.2f%%", progress * 100)));
      sb.append("|");
      progress = status.getReduceProgress();
      sb.append(
          String.format(
              "r %4d %6s",
              rednum, progress == 1 ? "100%" : String.format("%.2f%%", progress * 100)));

      System.out.println(sb.toString());
      printTaskAttempt(client.getTaskReports(jobid, TaskType.MAP));
      printTaskAttempt(client.getTaskReports(jobid, TaskType.REDUCE));
      System.out.println(sb.toString());

    } catch (Exception e) {
      System.out.println(e);
    }
  }
Example #2
0
  @Override
  public void write(DataOutput out) throws IOException {
    Text.writeString(out, queueName);
    WritableUtils.writeEnum(out, queueState);

    if (schedulingInfo != null) {
      Text.writeString(out, schedulingInfo);
    } else {
      Text.writeString(out, "N/A");
    }
    out.writeInt(stats.length);
    for (JobStatus stat : stats) {
      stat.write(out);
    }
    out.writeInt(children.size());
    for (QueueInfo childQueueInfo : children) {
      childQueueInfo.write(out);
    }
  }
Example #3
0
 @Override
 public void readFields(DataInput in) throws IOException {
   queueName = StringInterner.weakIntern(Text.readString(in));
   queueState = WritableUtils.readEnum(in, QueueState.class);
   schedulingInfo = StringInterner.weakIntern(Text.readString(in));
   int length = in.readInt();
   stats = new JobStatus[length];
   for (int i = 0; i < length; i++) {
     stats[i] = new JobStatus();
     stats[i].readFields(in);
   }
   int count = in.readInt();
   children.clear();
   for (int i = 0; i < count; i++) {
     QueueInfo childQueueInfo = new QueueInfo();
     childQueueInfo.readFields(in);
     children.add(childQueueInfo);
   }
 }