org.apache.hadoop.mapred

## Class Task.TaskReporter

- java.lang.Object
- - org.apache.hadoop.mapreduce.StatusReporter
  - - org.apache.hadoop.mapred.Task.TaskReporter

- All Implemented Interfaces:
    Runnable, Reporter, org.apache.hadoop.util.Progressable
  Enclosing class:
    Task

      @InterfaceAudience.LimitedPrivate(value="MapReduce")
       @InterfaceStability.Unstable
      public class Task.TaskReporter
      extends StatusReporter
      implements Runnable, Reporter

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Task.TaskReporter.DiskLimitCheck` disk limit checker, runs in separate thread when activated.
    `class` | `Task.TaskReporter.TaskLimitException` exception thrown when the task exceeds some configured limits.

  - ### Field Summary

    - ### Fields inherited from interface org.apache.hadoop.mapred.Reporter

      `NULL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskReporter(org.apache.hadoop.util.Progress taskProgress, TaskUmbilicalProtocol umbilical)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkTaskLimits()` check the counters to see whether the task has exceeded any configured limits.
    `Counters.Counter` | `getCounter(Enum<?> name)` Get the `Counters.Counter` of the given group with the given name.
    `Counters.Counter` | `getCounter(String group, String name)` Get the `Counters.Counter` of the given group with the given name.
    `InputSplit` | `getInputSplit()` Get the `InputSplit` object for a map.
    `float` | `getProgress()` Get the current progress.
    `void` | `incrCounter(Enum key, long amount)` Increments the counter identified by the key, which can be of any `Enum` type, by the specified amount.
    `void` | `incrCounter(String group, String counter, long amount)` Increments the counter identified by the group and counter name by the specified amount.
    `void` | `progress()`
    `void` | `run()` The communication thread handles communication with the parent (Task Tracker).
    `void` | `setInputSplit(InputSplit split)`
    `void` | `setProgress(float progress)`
    `void` | `setStatus(String status)` Set the status description for the task.
    `void` | `startCommunicationThread()`
    `void` | `startDiskLimitCheckerThreadIfNeeded()`
    `void` | `stopCommunicationThread()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TaskReporter

          public TaskReporter(org.apache.hadoop.util.Progress taskProgress,
                              TaskUmbilicalProtocol umbilical)

  - ### Method Detail

    - #### setStatus

          public void setStatus(String status)

      Description copied from interface: `Reporter`
      Set the status description for the task.
      Specified by:
        `setStatus` in interface `Reporter`
      Specified by:
        `setStatus` in class `StatusReporter`
      Parameters:
        `status` - brief description of the current status.

    - #### setProgress

          public void setProgress(float progress)

    - #### getProgress

          public float getProgress()

      Description copied from class: `StatusReporter`
      Get the current progress.
      Specified by:
        `getProgress` in interface `Reporter`
      Specified by:
        `getProgress` in class `StatusReporter`
      Returns:
        a number between 0.0 and 1.0 (inclusive) indicating the attempt's progress.

    - #### progress

          public void progress()

      Specified by:
        `progress` in interface `org.apache.hadoop.util.Progressable`
      Specified by:
        `progress` in class `StatusReporter`

    - #### getCounter

          public Counters.Counter getCounter(String group,
                                             String name)

      Description copied from interface: `Reporter`
      Get the `Counters.Counter` of the given group with the given name.
      Specified by:
        `getCounter` in interface `Reporter`
      Specified by:
        `getCounter` in class `StatusReporter`
      Parameters:
        `group` - counter group
        `name` - counter name
      Returns:
        the `Counter` of the given group/name.

    - #### getCounter

          public Counters.Counter getCounter(Enum<?> name)

      Description copied from interface: `Reporter`
      Get the `Counters.Counter` of the given group with the given name.
      Specified by:
        `getCounter` in interface `Reporter`
      Specified by:
        `getCounter` in class `StatusReporter`
      Parameters:
        `name` - counter name
      Returns:
        the `Counter` of the given group/name.

    - #### incrCounter

          public void incrCounter(Enum key,
                                  long amount)

      Description copied from interface: `Reporter`
      Increments the counter identified by the key, which can be of any `Enum` type, by the specified amount.
      Specified by:
        `incrCounter` in interface `Reporter`
      Parameters:
        `key` - key to identify the counter to be incremented. The key can be be any `Enum`.
        `amount` - A non-negative amount by which the counter is to be incremented.

    - #### incrCounter

          public void incrCounter(String group,
                                  String counter,
                                  long amount)

      Description copied from interface: `Reporter`
      Increments the counter identified by the group and counter name by the specified amount.
      Specified by:
        `incrCounter` in interface `Reporter`
      Parameters:
        `group` - name to identify the group of the counter to be incremented.
        `counter` - name to identify the counter within the group.
        `amount` - A non-negative amount by which the counter is to be incremented.

    - #### setInputSplit

          public void setInputSplit(InputSplit split)

    - #### getInputSplit

          public InputSplit getInputSplit()
                                   throws UnsupportedOperationException

      Description copied from interface: `Reporter`
      Get the `InputSplit` object for a map.
      Specified by:
        `getInputSplit` in interface `Reporter`
      Returns:
        the `InputSplit` that the map is reading from.
      Throws:
        `UnsupportedOperationException` - if called outside a mapper

    - #### checkTaskLimits

          protected void checkTaskLimits()
                                  throws Task.TaskReporter.TaskLimitException

      check the counters to see whether the task has exceeded any configured limits.
      Throws:
        `Task.TaskReporter.TaskLimitException`

    - #### run

          public void run()

      The communication thread handles communication with the parent (Task Tracker). It sends progress updates if progress has been made or if the task needs to let the parent know that it's alive. It also pings the parent to see if it's alive.
      Specified by:
        `run` in interface `Runnable`

    - #### startCommunicationThread

          public void startCommunicationThread()

    - #### startDiskLimitCheckerThreadIfNeeded

          public void startDiskLimitCheckerThreadIfNeeded()

    - #### stopCommunicationThread

          public void stopCommunicationThread()
                                       throws InterruptedException

      Throws:
        `InterruptedException`

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