org.apache.hadoop.mapred
Class TaskStatus

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

public abstract class TaskStatus
extends java.lang.Object
implements org.apache.hadoop.io.Writable, java.lang.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, java.lang.String diagnosticInfo, java.lang.String stateString, java.lang.String taskTracker, TaskStatus.Phase phase, Counters counters)
           
 
Method Summary
 java.lang.Object clone()
           
 Counters getCounters()
          Get task's counters.
 java.lang.String getDiagnosticInfo()
           
 java.util.List<TaskAttemptID> getFetchFailedMaps()
          Get the list of maps from which output-fetches failed.
 long getFinishTime()
          Get task finish time.
 boolean getIncludeAllCounters()
           
abstract  boolean getIsMap()
           
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.
 java.lang.String getStateString()
           
 TaskAttemptID getTaskID()
           
 java.lang.String getTaskTracker()
           
 void readFields(java.io.DataInput in)
           
 void setCounters(Counters counters)
          Set the task's counters.
 void setDiagnosticInfo(java.lang.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 setProgress(float progress)
           
 void setRunState(TaskStatus.State runState)
           
 void setStateString(java.lang.String stateString)
          Set the state of the TaskStatus.
 void setTaskTracker(java.lang.String tracker)
           
 void write(java.io.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,
                  java.lang.String diagnosticInfo,
                  java.lang.String stateString,
                  java.lang.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 java.lang.String getTaskTracker()

setTaskTracker

public void setTaskTracker(java.lang.String tracker)

setRunState

public void setRunState(TaskStatus.State runState)

getDiagnosticInfo

public java.lang.String getDiagnosticInfo()

setDiagnosticInfo

public void setDiagnosticInfo(java.lang.String info)

getStateString

public java.lang.String getStateString()

setStateString

public void setStateString(java.lang.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.

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

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 java.util.List<TaskAttemptID> getFetchFailedMaps()
Get the list of maps from which output-fetches failed.

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

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

write

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

readFields

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


Copyright © 2009 The Apache Software Foundation