org.apache.tez.dag.app.dag.impl
Class TaskImpl

java.lang.Object
  extended by org.apache.tez.dag.app.dag.impl.TaskImpl
All Implemented Interfaces:
org.apache.hadoop.yarn.event.EventHandler<TaskEvent>, Task

public 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.conf.Configuration conf
           
protected  org.apache.hadoop.yarn.event.EventHandler eventHandler
           
protected  org.apache.tez.dag.api.VertexLocationHint.TaskLocationHint locationHint
           
protected  TaskAttemptListener taskAttemptListener
           
protected  TaskHeartbeatHandler taskHeartbeatHandler
           
 
Constructor Summary
TaskImpl(org.apache.tez.dag.records.TezVertexID vertexId, int taskIndex, org.apache.hadoop.yarn.event.EventHandler eventHandler, org.apache.hadoop.conf.Configuration conf, TaskAttemptListener taskAttemptListener, org.apache.hadoop.yarn.util.Clock clock, TaskHeartbeatHandler thh, AppContext appContext, boolean leafVertex, org.apache.tez.dag.api.VertexLocationHint.TaskLocationHint locationHint, org.apache.hadoop.yarn.api.records.Resource resource, ContainerContext containerContext)
           
 
Method Summary
 boolean canCommit(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptID)
          Can the output of the taskAttempt be committed.
 TaskAttempt getAttempt(org.apache.tez.dag.records.TezTaskAttemptID attemptID)
           
 Map<org.apache.tez.dag.records.TezTaskAttemptID,TaskAttempt> getAttempts()
           
 org.apache.tez.common.counters.TezCounters getCounters()
           
 List<String> getDiagnostics()
           
 TaskStateInternal getInternalState()
           
 org.apache.tez.dag.records.TezTaskAttemptID getOutputConsumableAttempt()
          Get the attempt id which has reported in as output ready.
 float getProgress()
           
 TaskReport getReport()
           
protected  String getSplitsAsString()
           
 TaskState getState()
           
protected  TaskAttempt getSuccessfulAttempt()
           
 List<org.apache.tez.runtime.api.impl.TezEvent> getTaskAttemptTezEvents(org.apache.tez.dag.records.TezTaskAttemptID attemptID, int fromEventId, int maxEvents)
           
 org.apache.tez.dag.records.TezTaskID getTaskId()
           
 Vertex getVertex()
           
 void handle(TaskEvent event)
           
protected  void internalError(TaskEventType type)
           
 boolean isFinished()
          Has Task reached the final state or not.
protected  void logJobHistoryTaskFailedEvent(TaskState finalState)
           
protected  void logJobHistoryTaskFinishedEvent()
           
protected  void logJobHistoryTaskStartedEvent()
           
 boolean needsWaitAfterOutputConsumable()
          Do the running tasks need to stick around after they're done processing and generating output.
 TaskState restoreFromEvent(HistoryEvent historyEvent)
           
 
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.conf.Configuration conf

taskAttemptListener

protected final TaskAttemptListener taskAttemptListener

taskHeartbeatHandler

protected final TaskHeartbeatHandler taskHeartbeatHandler

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

locationHint

protected org.apache.tez.dag.api.VertexLocationHint.TaskLocationHint locationHint
Constructor Detail

TaskImpl

public TaskImpl(org.apache.tez.dag.records.TezVertexID vertexId,
                int taskIndex,
                org.apache.hadoop.yarn.event.EventHandler eventHandler,
                org.apache.hadoop.conf.Configuration conf,
                TaskAttemptListener taskAttemptListener,
                org.apache.hadoop.yarn.util.Clock clock,
                TaskHeartbeatHandler thh,
                AppContext appContext,
                boolean leafVertex,
                org.apache.tez.dag.api.VertexLocationHint.TaskLocationHint locationHint,
                org.apache.hadoop.yarn.api.records.Resource resource,
                ContainerContext containerContext)
Method Detail

getState

public TaskState getState()
Specified by:
getState in interface Task

getAttempts

public Map<org.apache.tez.dag.records.TezTaskAttemptID,TaskAttempt> getAttempts()
Specified by:
getAttempts in interface Task

getAttempt

public TaskAttempt getAttempt(org.apache.tez.dag.records.TezTaskAttemptID attemptID)
Specified by:
getAttempt in interface Task

getVertex

public Vertex getVertex()
Specified by:
getVertex in interface Task

getTaskId

public org.apache.tez.dag.records.TezTaskID getTaskId()
Specified by:
getTaskId 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 TaskReport getReport()
Specified by:
getReport in interface Task

getCounters

public org.apache.tez.common.counters.TezCounters getCounters()
Specified by:
getCounters in interface Task

getProgress

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

getTaskAttemptTezEvents

public List<org.apache.tez.runtime.api.impl.TezEvent> getTaskAttemptTezEvents(org.apache.tez.dag.records.TezTaskAttemptID attemptID,
                                                                              int fromEventId,
                                                                              int maxEvents)
Specified by:
getTaskAttemptTezEvents in interface Task

getDiagnostics

public List<String> getDiagnostics()
Specified by:
getDiagnostics in interface Task

restoreFromEvent

public TaskState restoreFromEvent(HistoryEvent historyEvent)
Specified by:
restoreFromEvent in interface Task

getInternalState

public TaskStateInternal getInternalState()

canCommit

public boolean canCommit(org.apache.tez.dag.records.TezTaskAttemptID 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.

needsWaitAfterOutputConsumable

public boolean needsWaitAfterOutputConsumable()
Description copied from interface: Task
Do the running tasks need to stick around after they're done processing and generating output. Required for tasks which have custom output handling such as in-memory shuffle.

Specified by:
needsWaitAfterOutputConsumable in interface Task
Returns:
whether the task needs to stick around.

getOutputConsumableAttempt

public org.apache.tez.dag.records.TezTaskAttemptID getOutputConsumableAttempt()
Description copied from interface: Task
Get the attempt id which has reported in as output ready. null if not applicable.

Specified by:
getOutputConsumableAttempt in interface Task
Returns:
the attempt id which has reported in as output ready. null if not applicable.

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).

logJobHistoryTaskStartedEvent

protected void logJobHistoryTaskStartedEvent()

logJobHistoryTaskFinishedEvent

protected void logJobHistoryTaskFinishedEvent()

logJobHistoryTaskFailedEvent

protected void logJobHistoryTaskFailedEvent(TaskState finalState)


Copyright © 2014 Apache Software Foundation. All rights reserved.