org.apache.hadoop.mapred
Class TaskStatus

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

public abstract class TaskStatus
extends Object
implements 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
 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 getIncludeCounters()
           
abstract  boolean getIsMap()
           
 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)
          Deserialize the fields of this object from in.
 void setCounters(Counters counters)
          Set the task's counters.
 void setDiagnosticInfo(String info)
           
 void setIncludeCounters(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(String stateString)
           
 void setTaskTracker(String tracker)
           
 void write(DataOutput out)
          Serialize the fields of this object to 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

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)

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

getIncludeCounters

public boolean getIncludeCounters()

setIncludeCounters

public void setIncludeCounters(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.

clone

public Object clone()
Overrides:
clone in class Object

write

public void write(DataOutput out)
           throws IOException
Description copied from interface: Writable
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Description copied from interface: Writable
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException


Copyright © 2009 The Apache Software Foundation