org.apache.hadoop.mapreduce.v2.app.job.impl

## Class TaskAttemptImpl

- java.lang.Object
- - org.apache.hadoop.mapreduce.v2.app.job.impl.TaskAttemptImpl

- All Implemented Interfaces:
    TaskAttempt, org.apache.hadoop.yarn.event.EventHandler<TaskAttemptEvent>
  Direct Known Subclasses:
    MapTaskAttemptImpl, ReduceTaskAttemptImpl

      public abstract class TaskAttemptImpl
      extends Object
      implements TaskAttempt, org.apache.hadoop.yarn.event.EventHandler<TaskAttemptEvent>

  Implementation of TaskAttempt interface.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.hadoop.mapred.JobConf` | `conf`
    `org.apache.hadoop.yarn.api.records.Container` | `container`
    `protected Set<String>` | `dataLocalHosts`
    `protected Set<String>` | `dataLocalRacks`
    `protected org.apache.hadoop.yarn.event.EventHandler` | `eventHandler`
    `protected org.apache.hadoop.fs.Path` | `jobFile`
    `protected int` | `partition`
    `protected static Map<org.apache.hadoop.mapreduce.v2.api.records.TaskType,org.apache.hadoop.yarn.api.records.Resource>` | `RESOURCE_REQUEST_CACHE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskAttemptImpl(org.apache.hadoop.mapreduce.v2.api.records.TaskId taskId, int i, org.apache.hadoop.yarn.event.EventHandler eventHandler, TaskAttemptListener taskAttemptListener, org.apache.hadoop.fs.Path jobFile, int partition, org.apache.hadoop.mapred.JobConf conf, String[] dataLocalHosts, org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> jobToken, org.apache.hadoop.security.Credentials credentials, org.apache.hadoop.yarn.util.Clock clock, AppContext appContext)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract org.apache.hadoop.mapred.Task` | `createRemoteTask()`
    `org.apache.hadoop.yarn.api.records.ContainerId` | `getAssignedContainerID()`
    `String` | `getAssignedContainerMgrAddress()`
    `org.apache.hadoop.mapreduce.v2.api.records.Avataar` | `getAvataar()`
    `org.apache.hadoop.mapreduce.Counters` | `getCounters()`
    `List<String>` | `getDiagnostics()`
    `protected static org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState` | `getExternalState(TaskAttemptStateInternal smState)`
    `long` | `getFinishTime()`
    `org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId` | `getID()`
    `TaskAttemptStateInternal` | `getInternalState()`
    `long` | `getLaunchTime()`
    `org.apache.hadoop.mapreduce.v2.api.records.Locality` | `getLocality()`
    `String` | `getNodeHttpAddress()` If container Assigned then return the node's address, otherwise null.
    `org.apache.hadoop.yarn.api.records.NodeId` | `getNodeId()`
    `String` | `getNodeRackName()` If container Assigned then return the node's rackname, otherwise null.
    `org.apache.hadoop.mapreduce.v2.api.records.Phase` | `getPhase()`
    `float` | `getProgress()`
    `org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport` | `getReport()`
    `long` | `getShuffleFinishTime()`
    `int` | `getShufflePort()`
    `long` | `getSortFinishTime()`
    `org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState` | `getState()`
    `void` | `handle(TaskAttemptEvent event)`
    `boolean` | `isFinished()` Has attempt reached the final state or not.
    `protected boolean` | `isIP(String src)`
    `boolean` | `isTaskFailFast()`
    `TaskAttemptStateInternal` | `recover(org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo taInfo, org.apache.hadoop.mapreduce.OutputCommitter committer, boolean recoverOutput)`
    `protected String` | `resolveHost(String src)`
    `protected Set<String>` | `resolveHosts(String[] src)`
    `void` | `setAvataar(org.apache.hadoop.mapreduce.v2.api.records.Avataar avataar)`
    `void` | `setLocality(org.apache.hadoop.mapreduce.v2.api.records.Locality locality)`
    `void` | `setTaskFailFast(boolean failFast)`

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

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

- - ### Field Detail

    - #### RESOURCE_REQUEST_CACHE

          protected static final Map<org.apache.hadoop.mapreduce.v2.api.records.TaskType,org.apache.hadoop.yarn.api.records.Resource> RESOURCE_REQUEST_CACHE

    - #### conf

          protected final org.apache.hadoop.mapred.JobConf conf

    - #### jobFile

          protected final org.apache.hadoop.fs.Path jobFile

    - #### partition

          protected final int partition

    - #### eventHandler

          protected org.apache.hadoop.yarn.event.EventHandler eventHandler

    - #### dataLocalHosts

          protected Set<String> dataLocalHosts

    - #### dataLocalRacks

          protected Set<String> dataLocalRacks

    - #### container

          public org.apache.hadoop.yarn.api.records.Container container

  - ### Constructor Detail

    - #### TaskAttemptImpl

          public TaskAttemptImpl(org.apache.hadoop.mapreduce.v2.api.records.TaskId taskId,
                                 int i,
                                 org.apache.hadoop.yarn.event.EventHandler eventHandler,
                                 TaskAttemptListener taskAttemptListener,
                                 org.apache.hadoop.fs.Path jobFile,
                                 int partition,
                                 org.apache.hadoop.mapred.JobConf conf,
                                 String[] dataLocalHosts,
                                 org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> jobToken,
                                 org.apache.hadoop.security.Credentials credentials,
                                 org.apache.hadoop.yarn.util.Clock clock,
                                 AppContext appContext)

  - ### Method Detail

    - #### getAssignedContainerID

          public org.apache.hadoop.yarn.api.records.ContainerId getAssignedContainerID()

      Specified by:
        `getAssignedContainerID` in interface `TaskAttempt`
      Returns:
        the container ID if a container is assigned, otherwise null.

    - #### getAssignedContainerMgrAddress

          public String getAssignedContainerMgrAddress()

      Specified by:
        `getAssignedContainerMgrAddress` in interface `TaskAttempt`
      Returns:
        container mgr address if a container is assigned, otherwise null.

    - #### getLaunchTime

          public long getLaunchTime()

      Specified by:
        `getLaunchTime` in interface `TaskAttempt`
      Returns:
        time at which container is launched. If container is not launched yet, returns 0.

    - #### getFinishTime

          public long getFinishTime()

      Specified by:
        `getFinishTime` in interface `TaskAttempt`
      Returns:
        attempt's finish time. If attempt is not finished yet, returns 0.

    - #### getShuffleFinishTime

          public long getShuffleFinishTime()

      Specified by:
        `getShuffleFinishTime` in interface `TaskAttempt`
      Returns:
        The attempt's shuffle finish time if the attempt is a reduce. If attempt is not finished yet, returns 0.

    - #### getSortFinishTime

          public long getSortFinishTime()

      Specified by:
        `getSortFinishTime` in interface `TaskAttempt`
      Returns:
        The attempt's sort or merge finish time if the attempt is a reduce. If attempt is not finished yet, returns 0.

    - #### getShufflePort

          public int getShufflePort()

      Specified by:
        `getShufflePort` in interface `TaskAttempt`
      Returns:
        the port shuffle is on.

    - #### getNodeId

          public org.apache.hadoop.yarn.api.records.NodeId getNodeId()

      Specified by:
        `getNodeId` in interface `TaskAttempt`
      Returns:
        node's id if a container is assigned, otherwise null.

    - #### getNodeHttpAddress

          public String getNodeHttpAddress()

      If container Assigned then return the node's address, otherwise null.
      Specified by:
        `getNodeHttpAddress` in interface `TaskAttempt`
      Returns:
        node's http address if a container is assigned, otherwise null.

    - #### getNodeRackName

          public String getNodeRackName()

      If container Assigned then return the node's rackname, otherwise null.
      Specified by:
        `getNodeRackName` in interface `TaskAttempt`
      Returns:
        node's rack name if a container is assigned, otherwise null.

    - #### createRemoteTask

          protected abstract org.apache.hadoop.mapred.Task createRemoteTask()

    - #### getID

          public org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId getID()

      Specified by:
        `getID` in interface `TaskAttempt`

    - #### isFinished

          public boolean isFinished()

      Description copied from interface: `TaskAttempt`
      Has attempt reached the final state or not.
      Specified by:
        `isFinished` in interface `TaskAttempt`
      Returns:
        true if it has finished, else false

    - #### getReport

          public org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport getReport()

      Specified by:
        `getReport` in interface `TaskAttempt`

    - #### getDiagnostics

          public List<String> getDiagnostics()

      Specified by:
        `getDiagnostics` in interface `TaskAttempt`

    - #### getCounters

          public org.apache.hadoop.mapreduce.Counters getCounters()

      Specified by:
        `getCounters` in interface `TaskAttempt`

    - #### getProgress

          public float getProgress()

      Specified by:
        `getProgress` in interface `TaskAttempt`

    - #### getPhase

          public org.apache.hadoop.mapreduce.v2.api.records.Phase getPhase()

      Specified by:
        `getPhase` in interface `TaskAttempt`

    - #### getState

          public org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState getState()

      Specified by:
        `getState` in interface `TaskAttempt`

    - #### handle

          public void handle(TaskAttemptEvent event)

      Specified by:
        `handle` in interface `org.apache.hadoop.yarn.event.EventHandler<TaskAttemptEvent>`

    - #### getInternalState

          public TaskAttemptStateInternal getInternalState()

    - #### getLocality

          public org.apache.hadoop.mapreduce.v2.api.records.Locality getLocality()

    - #### setLocality

          public void setLocality(org.apache.hadoop.mapreduce.v2.api.records.Locality locality)

    - #### getAvataar

          public org.apache.hadoop.mapreduce.v2.api.records.Avataar getAvataar()

    - #### setAvataar

          public void setAvataar(org.apache.hadoop.mapreduce.v2.api.records.Avataar avataar)

    - #### setTaskFailFast

          public void setTaskFailFast(boolean failFast)

    - #### isTaskFailFast

          public boolean isTaskFailFast()

    - #### recover

          public TaskAttemptStateInternal recover(org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo taInfo,
                                                  org.apache.hadoop.mapreduce.OutputCommitter committer,
                                                  boolean recoverOutput)

    - #### getExternalState

          protected static org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState getExternalState(TaskAttemptStateInternal smState)

    - #### resolveHosts

          protected Set<String> resolveHosts(String[] src)

    - #### resolveHost

          protected String resolveHost(String src)

    - #### isIP

          protected boolean isIP(String src)

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