org.apache.hadoop.mapreduce

## Class TaskCompletionEvent

- java.lang.Object
- - org.apache.hadoop.mapreduce.TaskCompletionEvent

- All Implemented Interfaces:
    org.apache.hadoop.io.Writable
  Direct Known Subclasses:
    TaskCompletionEvent

      @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class TaskCompletionEvent
      extends Object
      implements org.apache.hadoop.io.Writable

  This is used to track task completion events on job tracker.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TaskCompletionEvent.Status`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TaskCompletionEvent[]` | `EMPTY_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskCompletionEvent()` Default constructor for Writable.
    `TaskCompletionEvent(int eventId, TaskAttemptID taskId, int idWithinJob, boolean isMap, TaskCompletionEvent.Status status, String taskTrackerHttp)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `getEventId()` Returns event Id.
    `TaskCompletionEvent.Status` | `getStatus()` Returns `TaskCompletionEvent.Status`
    `TaskAttemptID` | `getTaskAttemptId()` Returns task id.
    `int` | `getTaskRunTime()` Returns time (in millisec) the task took to complete.
    `String` | `getTaskTrackerHttp()` http location of the tasktracker where this task ran.
    `int` | `hashCode()`
    `int` | `idWithinJob()`
    `boolean` | `isMapTask()`
    `void` | `readFields(DataInput in)`
    `protected void` | `setEventId(int eventId)` set event Id.
    `protected void` | `setTaskAttemptId(TaskAttemptID taskId)` Sets task id.
    `protected void` | `setTaskRunTime(int taskCompletionTime)` Set the task completion time
    `protected void` | `setTaskStatus(TaskCompletionEvent.Status status)` Set task status.
    `protected void` | `setTaskTrackerHttp(String taskTrackerHttp)` Set task tracker http location.
    `String` | `toString()`
    `void` | `write(DataOutput out)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_ARRAY

          public static final TaskCompletionEvent[] EMPTY_ARRAY

  - ### Constructor Detail

    - #### TaskCompletionEvent

          public TaskCompletionEvent()

      Default constructor for Writable.

    - #### TaskCompletionEvent

          public TaskCompletionEvent(int eventId,
                                     TaskAttemptID taskId,
                                     int idWithinJob,
                                     boolean isMap,
                                     TaskCompletionEvent.Status status,
                                     String taskTrackerHttp)

      Constructor. eventId should be created externally and incremented per event for each job.
      Parameters:
        `eventId` - event id, event id should be unique and assigned in incrementally, starting from 0.
        `taskId` - task id
        `status` - task's status
        `taskTrackerHttp` - task tracker's host:port for http.

  - ### Method Detail

    - #### getEventId

          public int getEventId()

      Returns event Id.
      Returns:
        event id

    - #### getTaskAttemptId

          public TaskAttemptID getTaskAttemptId()

      Returns task id.
      Returns:
        task id

    - #### getStatus

          public TaskCompletionEvent.Status getStatus()

      Returns `TaskCompletionEvent.Status`
      Returns:
        task completion status

    - #### getTaskTrackerHttp

          public String getTaskTrackerHttp()

      http location of the tasktracker where this task ran.
      Returns:
        http location of tasktracker user logs

    - #### getTaskRunTime

          public int getTaskRunTime()

      Returns time (in millisec) the task took to complete.

    - #### setTaskRunTime

          protected void setTaskRunTime(int taskCompletionTime)

      Set the task completion time
      Parameters:
        `taskCompletionTime` - time (in millisec) the task took to complete

    - #### setEventId

          protected void setEventId(int eventId)

      set event Id. should be assigned incrementally starting from 0.
      Parameters:
        `eventId` -

    - #### setTaskAttemptId

          protected void setTaskAttemptId(TaskAttemptID taskId)

      Sets task id.
      Parameters:
        `taskId` -

    - #### setTaskStatus

          protected void setTaskStatus(TaskCompletionEvent.Status status)

      Set task status.
      Parameters:
        `status` -

    - #### setTaskTrackerHttp

          protected void setTaskTrackerHttp(String taskTrackerHttp)

      Set task tracker http location.
      Parameters:
        `taskTrackerHttp` -

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### isMapTask

          public boolean isMapTask()

    - #### idWithinJob

          public int idWithinJob()

    - #### write

          public void write(DataOutput out)
                     throws IOException

      Specified by:
        `write` in interface `org.apache.hadoop.io.Writable`
      Throws:
        `IOException`

    - #### readFields

          public void readFields(DataInput in)
                          throws IOException

      Specified by:
        `readFields` in interface `org.apache.hadoop.io.Writable`
      Throws:
        `IOException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.