org.apache.hadoop.mapred
Class TaskCompletionEvent

java.lang.Object
  extended by org.apache.hadoop.mapred.TaskCompletionEvent
All Implemented Interfaces:
Writable

public class TaskCompletionEvent
extends Object
implements Writable

This is used to track task completion events on job tracker.


Nested Class Summary
static class TaskCompletionEvent.Status
           
 
Field Summary
static TaskCompletionEvent[] EMPTY_ARRAY
           
 
Constructor Summary
TaskCompletionEvent()
          Default constructor for Writable.
TaskCompletionEvent(int eventId, TaskAttemptID taskId, int idWithinJob, boolean isMap, TaskCompletionEvent.Status status, String taskTrackerHttp)
          Constructor.
 
Method Summary
 boolean equals(Object o)
           
 int getEventId()
          Returns event Id.
 TaskAttemptID getTaskAttemptId()
          Returns task id.
 String getTaskId()
          Deprecated. use getTaskAttemptId() instead.
 int getTaskRunTime()
          Returns time (in millisec) the task took to complete.
 TaskCompletionEvent.Status getTaskStatus()
          Returns enum Status.SUCESS or Status.FAILURE.
 String getTaskTrackerHttp()
          http location of the tasktracker where this task ran.
 int hashCode()
           
 int idWithinJob()
           
 boolean isMapTask()
           
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 void setEventId(int eventId)
          set event Id.
 void setTaskId(String taskId)
          Deprecated. use setTaskID(TaskAttemptID) instead.
 void setTaskID(TaskAttemptID taskId)
          Sets task id.
 void setTaskRunTime(int taskCompletionTime)
          Set the task completion time
 void setTaskStatus(TaskCompletionEvent.Status status)
          Set task status.
 void setTaskTrackerHttp(String taskTrackerHttp)
          Set task tracker http location.
 String toString()
           
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final TaskCompletionEvent[] EMPTY_ARRAY
Constructor Detail

TaskCompletionEvent

public TaskCompletionEvent()
Default constructor for Writable.


TaskCompletionEvent

public TaskCompletionEvent(int eventId,
                           TaskAttemptID taskId,
                           int idWithinJob,
                           boolean isMap,
                           TaskCompletionEvent.Status status,
                           String taskTrackerHttp)
Constructor. eventId should be created externally and incremented per event for each job.

Parameters:
eventId - event id, event id should be unique and assigned in incrementally, starting from 0.
taskId - task id
status - task's status
taskTrackerHttp - task tracker's host:port for http.
Method Detail

getEventId

public int getEventId()
Returns event Id.

Returns:
event id

getTaskId

@Deprecated
public String getTaskId()
Deprecated. use getTaskAttemptId() instead.

Returns task id.

Returns:
task id

getTaskAttemptId

public TaskAttemptID getTaskAttemptId()
Returns task id.

Returns:
task id

getTaskStatus

public TaskCompletionEvent.Status getTaskStatus()
Returns enum Status.SUCESS or Status.FAILURE.

Returns:
task tracker status

getTaskTrackerHttp

public String getTaskTrackerHttp()
http location of the tasktracker where this task ran.

Returns:
http location of tasktracker user logs

getTaskRunTime

public int getTaskRunTime()
Returns time (in millisec) the task took to complete.


setTaskRunTime

public void setTaskRunTime(int taskCompletionTime)
Set the task completion time

Parameters:
taskCompletionTime - time (in millisec) the task took to complete

setEventId

public void setEventId(int eventId)
set event Id. should be assigned incrementally starting from 0.

Parameters:
eventId -

setTaskId

@Deprecated
public void setTaskId(String taskId)
Deprecated. use setTaskID(TaskAttemptID) instead.

Sets task id.

Parameters:
taskId -

setTaskID

public void setTaskID(TaskAttemptID taskId)
Sets task id.

Parameters:
taskId -

setTaskStatus

public void setTaskStatus(TaskCompletionEvent.Status status)
Set task status.

Parameters:
status -

setTaskTrackerHttp

public void setTaskTrackerHttp(String taskTrackerHttp)
Set task tracker http location.

Parameters:
taskTrackerHttp -

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isMapTask

public boolean isMapTask()

idWithinJob

public int idWithinJob()

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