org.apache.hadoop.mapred
Class TaskStatus

java.lang.Object
  extended by org.apache.hadoop.mapred.TaskStatus
All Implemented Interfaces:
Cloneable, org.apache.hadoop.io.Writable

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract class TaskStatus
extends Object
implements org.apache.hadoop.io.Writable, Cloneable

Describes the current status of a task. This is not intended to be a comprehensive piece of data.


Nested Class Summary
static class TaskStatus.Phase
           
static class TaskStatus.State
           
 
Constructor Summary
TaskStatus()
           
TaskStatus(TaskAttemptID taskid, float progress, int numSlots, TaskStatus.State runState, String diagnosticInfo, String stateString, String taskTracker, TaskStatus.Phase phase, Counters counters)
           
 
Method Summary
abstract  void addFetchFailedMap(TaskAttemptID mapTaskId)
          Add to the list of maps from which output-fetches failed.
 Object clone()
           
 Counters getCounters()
          Get task's counters.
 String getDiagnosticInfo()
           
 List<TaskAttemptID> getFetchFailedMaps()
          Get the list of maps from which output-fetches failed.
 long getFinishTime()
          Get task finish time.
 boolean getIncludeAllCounters()
           
abstract  boolean getIsMap()
           
 long getMapFinishTime()
          Get map phase finish time for the task.
protected  int getMaxStringSize()
          Testcases can override getMaxStringSize() to control the max-size of strings in TaskStatus.
 org.apache.hadoop.mapred.SortedRanges.Range getNextRecordRange()
          Get the next record range which is going to be processed by Task.
 int getNumSlots()
           
 long getOutputSize()
          Returns the number of bytes of output from this map.
 TaskStatus.Phase getPhase()
          Get current phase of this task.
 float getProgress()
           
 TaskStatus.State getRunState()
           
 long getShuffleFinishTime()
          Get shuffle finish time for the task.
 long getSortFinishTime()
          Get sort finish time for the task,.
 long getStartTime()
          Get start time of the task.
 String getStateString()
           
 TaskAttemptID getTaskID()
           
 String getTaskTracker()
           
 void readFields(DataInput in)
           
 void setCounters(Counters counters)
          Set the task's counters.
 void setDiagnosticInfo(String info)
           
 void setIncludeAllCounters(boolean send)
           
 void setNextRecordRange(org.apache.hadoop.mapred.SortedRanges.Range nextRecordRange)
          Set the next record range which is going to be processed by Task.
 void setPhase(TaskStatus.Phase phase)
          Set current phase of this task.
 void setProgress(float progress)
           
 void setRunState(TaskStatus.State runState)
           
 void setStateString(String stateString)
          Set the state of the TaskStatus.
 void setTaskTracker(String tracker)
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskStatus

public TaskStatus()

TaskStatus

public TaskStatus(TaskAttemptID taskid,
                  float progress,
                  int numSlots,
                  TaskStatus.State runState,
                  String diagnosticInfo,
                  String stateString,
                  String taskTracker,
                  TaskStatus.Phase phase,
                  Counters counters)
Method Detail

getMaxStringSize

protected int getMaxStringSize()
Testcases can override getMaxStringSize() to control the max-size of strings in TaskStatus. Note that the TaskStatus is never exposed to clients or users (i.e Map or Reduce) and hence users cannot override this api to pass large strings in TaskStatus.


getTaskID

public TaskAttemptID getTaskID()

getIsMap

public abstract boolean getIsMap()

getNumSlots

public int getNumSlots()

getProgress

public float getProgress()

setProgress

public void setProgress(float progress)

getRunState

public TaskStatus.State getRunState()

getTaskTracker

public String getTaskTracker()

setTaskTracker

public void setTaskTracker(String tracker)

setRunState

public void setRunState(TaskStatus.State runState)

getDiagnosticInfo

public String getDiagnosticInfo()

setDiagnosticInfo

public void setDiagnosticInfo(String info)

getStateString

public String getStateString()

setStateString

public void setStateString(String stateString)
Set the state of the TaskStatus.


getNextRecordRange

public org.apache.hadoop.mapred.SortedRanges.Range getNextRecordRange()
Get the next record range which is going to be processed by Task.

Returns:
nextRecordRange

setNextRecordRange

public void setNextRecordRange(org.apache.hadoop.mapred.SortedRanges.Range nextRecordRange)
Set the next record range which is going to be processed by Task.

Parameters:
nextRecordRange -

getFinishTime

public long getFinishTime()
Get task finish time. if shuffleFinishTime and sortFinishTime are not set before, these are set to finishTime. It takes care of the case when shuffle, sort and finish are completed with in the heartbeat interval and are not reported separately. if task state is TaskStatus.FAILED then finish time represents when the task failed.

Returns:
finish time of the task.

getShuffleFinishTime

public long getShuffleFinishTime()
Get shuffle finish time for the task. If shuffle finish time was not set due to shuffle/sort/finish phases ending within same heartbeat interval, it is set to finish time of next phase i.e. sort or task finish when these are set.

Returns:
0 if shuffleFinishTime, sortFinishTime and finish time are not set. else it returns approximate shuffle finish time.

getMapFinishTime

public long getMapFinishTime()
Get map phase finish time for the task. If map finsh time was not set due to sort phase ending within same heartbeat interval, it is set to finish time of next phase i.e. sort phase when it is set.

Returns:
0 if mapFinishTime, sortFinishTime are not set. else it returns approximate map finish time.

getSortFinishTime

public long getSortFinishTime()
Get sort finish time for the task,. If sort finish time was not set due to sort and reduce phase finishing in same heartebat interval, it is set to finish time, when finish time is set.

Returns:
0 if sort finish time and finish time are not set, else returns sort finish time if that is set, else it returns finish time.

getStartTime

public long getStartTime()
Get start time of the task.

Returns:
0 is start time is not set, else returns start time.

getPhase

public TaskStatus.Phase getPhase()
Get current phase of this task. Phase.Map in case of map tasks, for reduce one of Phase.SHUFFLE, Phase.SORT or Phase.REDUCE.

Returns:
.

setPhase

public void setPhase(TaskStatus.Phase phase)
Set current phase of this task.

Parameters:
phase - phase of this task

getIncludeAllCounters

public boolean getIncludeAllCounters()

setIncludeAllCounters

public void setIncludeAllCounters(boolean send)

getCounters

public Counters getCounters()
Get task's counters.


setCounters

public void setCounters(Counters counters)
Set the task's counters.

Parameters:
counters -

getOutputSize

public long getOutputSize()
Returns the number of bytes of output from this map.


getFetchFailedMaps

public List<TaskAttemptID> getFetchFailedMaps()
Get the list of maps from which output-fetches failed.

Returns:
the list of maps from which output-fetches failed.

addFetchFailedMap

public abstract void addFetchFailedMap(TaskAttemptID mapTaskId)
Add to the list of maps from which output-fetches failed.

Parameters:
mapTaskId - map from which fetch failed

clone

public Object clone()
Overrides:
clone in class Object

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.