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

java.lang.Object
  extended by 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
protected  org.apache.hadoop.mapred.JobConf conf
           
protected  org.apache.hadoop.yarn.event.EventHandler eventHandler
           
protected  org.apache.hadoop.fs.Path jobFile
           
protected  int partition
           
 
Constructor Summary
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.mapreduce.OutputCommitter committer, org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> jobToken, Collection<org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier>> fsTokens, org.apache.hadoop.yarn.Clock clock)
           
 
Method Summary
protected abstract  org.apache.hadoop.mapred.Task createRemoteTask()
           
 org.apache.hadoop.yarn.api.records.ContainerId getAssignedContainerID()
           
 String getAssignedContainerMgrAddress()
           
 org.apache.hadoop.mapreduce.Counters getCounters()
           
 List<String> getDiagnostics()
           
 long getFinishTime()
           
 org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId getID()
           
 long getLaunchTime()
           
 String getNodeHttpAddress()
          If container Assigned then return the node's address, otherwise null.
 String getNodeRackName()
          If container Assigned then return the node's rackname, otherwise null.
 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)
           
protected  String resolveHost(String src)
           
protected  String[] resolveHosts(String[] src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
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.mapreduce.OutputCommitter committer,
                       org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> jobToken,
                       Collection<org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier>> fsTokens,
                       org.apache.hadoop.yarn.Clock clock)
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.

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

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>

resolveHosts

protected String[] resolveHosts(String[] src)

resolveHost

protected String resolveHost(String src)

isIP

protected boolean isIP(String src)


Copyright © 2012 Apache Software Foundation. All Rights Reserved.