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

java.lang.Object
  extended by org.apache.hadoop.mapreduce.v2.app.job.impl.TaskImpl
All Implemented Interfaces:
Task, org.apache.hadoop.yarn.event.EventHandler<TaskEvent>
Direct Known Subclasses:
MapTaskImpl, ReduceTaskImpl

public abstract class TaskImpl
extends Object
implements Task, org.apache.hadoop.yarn.event.EventHandler<TaskEvent>

Implementation of Task interface.


Field Summary
protected  AppContext appContext
           
protected  org.apache.hadoop.yarn.util.Clock clock
           
protected  org.apache.hadoop.mapred.JobConf conf
           
protected  org.apache.hadoop.security.Credentials credentials
           
protected  boolean encryptedShuffle
           
protected  org.apache.hadoop.yarn.event.EventHandler eventHandler
           
protected  org.apache.hadoop.fs.Path jobFile
           
protected  org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> jobToken
           
protected  int nextAttemptNumber
           
protected  int partition
           
protected  TaskAttemptListener taskAttemptListener
           
 
Constructor Summary
TaskImpl(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId, org.apache.hadoop.mapreduce.v2.api.records.TaskType taskType, int partition, org.apache.hadoop.yarn.event.EventHandler eventHandler, org.apache.hadoop.fs.Path remoteJobConfFile, org.apache.hadoop.mapred.JobConf conf, TaskAttemptListener taskAttemptListener, 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, int appAttemptId, MRAppMetrics metrics, AppContext appContext)
           
 
Method Summary
 boolean canCommit(org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId taskAttemptID)
          Can the output of the taskAttempt be committed.
protected abstract  TaskAttemptImpl createAttempt()
           
 TaskAttempt getAttempt(org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId attemptID)
           
 Map<org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId,TaskAttempt> getAttempts()
           
 org.apache.hadoop.mapreduce.Counters getCounters()
           
 org.apache.hadoop.mapreduce.v2.api.records.TaskId getID()
           
 TaskStateInternal getInternalState()
           
protected abstract  int getMaxAttempts()
           
 float getProgress()
           
 org.apache.hadoop.mapreduce.v2.api.records.TaskReport getReport()
           
protected  String getSplitsAsString()
           
 org.apache.hadoop.mapreduce.v2.api.records.TaskState getState()
           
protected  TaskAttempt getSuccessfulAttempt()
           
 void handle(TaskEvent event)
           
protected  void internalError(TaskEventType type)
           
 boolean isFinished()
          Has Task reached the final state or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.mapreduce.v2.app.job.Task
getType
 

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

taskAttemptListener

protected final TaskAttemptListener taskAttemptListener

eventHandler

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

clock

protected final org.apache.hadoop.yarn.util.Clock clock

appContext

protected final AppContext appContext

encryptedShuffle

protected boolean encryptedShuffle

credentials

protected org.apache.hadoop.security.Credentials credentials

jobToken

protected org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> jobToken

nextAttemptNumber

protected int nextAttemptNumber
Constructor Detail

TaskImpl

public TaskImpl(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId,
                org.apache.hadoop.mapreduce.v2.api.records.TaskType taskType,
                int partition,
                org.apache.hadoop.yarn.event.EventHandler eventHandler,
                org.apache.hadoop.fs.Path remoteJobConfFile,
                org.apache.hadoop.mapred.JobConf conf,
                TaskAttemptListener taskAttemptListener,
                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,
                int appAttemptId,
                MRAppMetrics metrics,
                AppContext appContext)
Method Detail

getState

public org.apache.hadoop.mapreduce.v2.api.records.TaskState getState()
Specified by:
getState in interface Task

getAttempts

public Map<org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId,TaskAttempt> getAttempts()
Specified by:
getAttempts in interface Task

getAttempt

public TaskAttempt getAttempt(org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId attemptID)
Specified by:
getAttempt in interface Task

getID

public org.apache.hadoop.mapreduce.v2.api.records.TaskId getID()
Specified by:
getID in interface Task

isFinished

public boolean isFinished()
Description copied from interface: Task
Has Task reached the final state or not.

Specified by:
isFinished in interface Task

getReport

public org.apache.hadoop.mapreduce.v2.api.records.TaskReport getReport()
Specified by:
getReport in interface Task

getCounters

public org.apache.hadoop.mapreduce.Counters getCounters()
Specified by:
getCounters in interface Task

getProgress

public float getProgress()
Specified by:
getProgress in interface Task

getInternalState

public TaskStateInternal getInternalState()

canCommit

public boolean canCommit(org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId taskAttemptID)
Description copied from interface: Task
Can the output of the taskAttempt be committed. Note that once the task gives a go for a commit, further canCommit requests from any other attempts should return false.

Specified by:
canCommit in interface Task
Returns:
whether the attempt's output can be committed or not.

createAttempt

protected abstract TaskAttemptImpl createAttempt()

getMaxAttempts

protected abstract int getMaxAttempts()

getSuccessfulAttempt

protected TaskAttempt getSuccessfulAttempt()

handle

public void handle(TaskEvent event)
Specified by:
handle in interface org.apache.hadoop.yarn.event.EventHandler<TaskEvent>

internalError

protected void internalError(TaskEventType type)

getSplitsAsString

protected String getSplitsAsString()
Returns:
a String representation of the splits. Subclasses can override this method to provide their own representations of splits (if any).


Copyright © 2014 Apache Software Foundation. All Rights Reserved.