分享

MapReduce源码中无法找到TaskAttemptFinished类

oChengZi1234 发表于 2013-10-26 15:14:21 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 2 5299
org.apache.hadoop.mapreduce.jobhistory.TaskAttemptFinishedEvent.java中有如下语句
private TaskAttemptFinished datum = new TaskAttemptFinished()。。。
但是编译出现错误,说找不到TaskAttemptFished,我找遍代码也找不到这个类啊。。。
莫非这个类是编译的时候动态生成的吗?
有人知道这个类吗吗?

已有(2)人评论

跳转到指定楼层
shihailong123 发表于 2013-10-26 15:14:21
在TaskAttemptFinishedEvent.java文件中,位于mapreduce/jobhistory目录下:
[ol]
  • /**
  • * Event to record successful task completion
  • *
  • */
  • @InterfaceAudience.Private
  • @InterfaceStability.Unstable
  • public class TaskAttemptFinishedEvent  implements HistoryEvent {
  •   private TaskAttemptFinished datum = new TaskAttemptFinished();
  •   /**
  •    * Create an event to record successful finishes for setup and cleanup
  •    * attempts
  •    * @param id Attempt ID
  •    * @param taskType Type of task
  •    * @param taskStatus Status of task
  •    * @param finishTime Finish time of attempt
  •    * @param hostname Host where the attempt executed
  •    * @param state State string
  •    * @param counters Counters for the attempt
  •    */
  •   public TaskAttemptFinishedEvent(TaskAttemptID id,
  •       TaskType taskType, String taskStatus,
  •       long finishTime,
  •       String hostname, String state, Counters counters) {
  •     datum.taskid = new Utf8(id.getTaskID().toString());
  •     datum.attemptId = new Utf8(id.toString());
  •     datum.taskType = new Utf8(taskType.name());
  •     datum.taskStatus = new Utf8(taskStatus);
  •     datum.finishTime = finishTime;
  •     datum.hostname = new Utf8(hostname);
  •     datum.state = new Utf8(state);
  •     datum.counters = EventWriter.toAvro(counters);
  •   }
  •   TaskAttemptFinishedEvent() {}
  •   public Object getDatum() { return datum; }
  •   public void setDatum(Object datum) {
  •     this.datum = (TaskAttemptFinished)datum;
  •   }
  •   /** Get the task ID */
  •   public TaskID getTaskId() { return TaskID.forName(datum.taskid.toString()); }
  •   /** Get the task attempt id */
  •   public TaskAttemptID getAttemptId() {
  •     return TaskAttemptID.forName(datum.attemptId.toString());
  •   }
  •   /** Get the task type */
  •   public TaskType getTaskType() {
  •     return TaskType.valueOf(datum.taskType.toString());
  •   }
  •   /** Get the task status */
  •   public String getTaskStatus() { return datum.taskStatus.toString(); }
  •   /** Get the attempt finish time */
  •   public long getFinishTime() { return datum.finishTime; }
  •   /** Get the host where the attempt executed */
  •   public String getHostname() { return datum.hostname.toString(); }
  •   /** Get the state string */
  •   public String getState() { return datum.state.toString(); }
  •   /** Get the counters for the attempt */
  •   Counters getCounters() { return EventReader.fromAvro(datum.counters); }
  •   /** Get the event type */
  •   public EventType getEventType() {
  •     // Note that the task type can be setup/map/reduce/cleanup but the
  •     // attempt-type can only be map/reduce.
  •     return getTaskId().getTaskType() == TaskType.MAP
  •            ? EventType.MAP_ATTEMPT_FINISHED
  •            : EventType.REDUCE_ATTEMPT_FINISHED;
  •   }
  • }[/ol]复制代码
  • 回复

    使用道具 举报

    mexiang 发表于 2013-10-26 15:14:21
    TaskAttemptFinishedEvent这个类,我当然找到了啊,我找不到的类是TaskAttemptFinished,
    最后在build目录找到了,可见这个类是编译过程中产生的,svn中并没有这个类
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    推荐上一条 /2 下一条