示例#1
0
 private TaskAttemptUnsuccessfulCompletion getTaskAttemptUnsuccessfulCompletion() {
   TaskAttemptUnsuccessfulCompletion datum = new TaskAttemptUnsuccessfulCompletion();
   datum.setAttemptId("attempt_1_2_r3_4_5");
   datum.setClockSplits(Arrays.asList(1, 2, 3));
   datum.setCpuUsages(Arrays.asList(100, 200, 300));
   datum.setError("Error");
   datum.setFinishTime(2L);
   datum.setHostname("hostname");
   datum.setRackname("rackname");
   datum.setPhysMemKbytes(Arrays.asList(1000, 2000, 3000));
   datum.setTaskid(taskId);
   datum.setPort(1000);
   datum.setTaskType("REDUCE");
   datum.setStatus("STATUS");
   datum.setCounters(getCounters());
   datum.setVMemKbytes(Arrays.asList(1000, 2000, 3000));
   return datum;
 }
  /**
   * Create an event to record the unsuccessful completion of attempts
   *
   * @param id Attempt ID
   * @param taskType Type of the task
   * @param status Status of the attempt
   * @param finishTime Finish time of the attempt
   * @param hostname Name of the host where the attempt executed
   * @param error Error string
   * @param allSplits the "splits", or a pixelated graph of various measurable worker node state
   *     variables against progress. Currently there are four; wallclock time, CPU time, virtual
   *     memory and physical memory.
   */
  public TaskAttemptUnsuccessfulCompletionEvent(
      TaskAttemptID id,
      TaskType taskType,
      String status,
      long finishTime,
      String hostname,
      String error,
      int[][] allSplits) {
    datum.taskid = new Utf8(id.getTaskID().toString());
    datum.taskType = new Utf8(taskType.name());
    datum.attemptId = new Utf8(id.toString());
    datum.finishTime = finishTime;
    datum.hostname = new Utf8(hostname);
    datum.error = new Utf8(error);
    datum.status = new Utf8(status);

    datum.clockSplits = AvroArrayUtils.toAvro(ProgressSplitsBlock.arrayGetWallclockTime(allSplits));
    datum.cpuUsages = AvroArrayUtils.toAvro(ProgressSplitsBlock.arrayGetCPUTime(allSplits));
    datum.vMemKbytes = AvroArrayUtils.toAvro(ProgressSplitsBlock.arrayGetVMemKbytes(allSplits));
    datum.physMemKbytes =
        AvroArrayUtils.toAvro(ProgressSplitsBlock.arrayGetPhysMemKbytes(allSplits));
  }