org.apache.hadoop.mapred
Class JobHistory.Task

java.lang.Object
  extended by org.apache.hadoop.mapred.JobHistory.Task
Direct Known Subclasses:
JobHistory.TaskAttempt
Enclosing class:
JobHistory

public static class JobHistory.Task
extends Object

Helper class for logging or reading back events related to Task's start, finish or failure. All events logged by this class are logged in a separate file per job in job tracker history. These events map to TIPs in jobtracker.


Constructor Summary
JobHistory.Task()
           
 
Method Summary
 String get(JobHistory.Keys k)
          Get 'String' value for given key.
 int getInt(JobHistory.Keys k)
          Convert value from history to int and return.
 long getLong(JobHistory.Keys k)
          Convert value from history to int and return.
 Map<String,JobHistory.TaskAttempt> getTaskAttempts()
          Returns all task attempts for this task.
 Map<JobHistory.Keys,String> getValues()
          Returns Map containing all key-values.
 void handle(Map<JobHistory.Keys,String> values)
          Reads values back from the history, input is same Map as passed to Listener by parseHistory().
static void logFailed(TaskID taskId, String taskType, long time, String error)
          Log job failed event.
static void logFailed(TaskID taskId, String taskType, long time, String error, TaskAttemptID failedDueToAttempt)
           
static void logFinished(TaskID taskId, String taskType, long finishTime, Counters counters)
          Log finish time of task.
static void logStarted(TaskID taskId, String taskType, long startTime, String splitLocations)
          Log start time of task (TIP).
static void logUpdates(TaskID taskId, long finishTime)
          Update the finish time of task.
 void set(JobHistory.Keys k, String s)
          Set value for the key.
 void set(Map<JobHistory.Keys,String> m)
          Adds all values in the Map argument to its own values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobHistory.Task

public JobHistory.Task()
Method Detail

logStarted

public static void logStarted(TaskID taskId,
                              String taskType,
                              long startTime,
                              String splitLocations)
Log start time of task (TIP).

Parameters:
taskId - task id
taskType - MAP or REDUCE
startTime - startTime of tip.

logFinished

public static void logFinished(TaskID taskId,
                               String taskType,
                               long finishTime,
                               Counters counters)
Log finish time of task.

Parameters:
taskId - task id
taskType - MAP or REDUCE
finishTime - finish timeof task in ms

logUpdates

public static void logUpdates(TaskID taskId,
                              long finishTime)
Update the finish time of task.

Parameters:
taskId - task id
finishTime - finish time of task in ms

logFailed

public static void logFailed(TaskID taskId,
                             String taskType,
                             long time,
                             String error)
Log job failed event.

Parameters:
taskId - task id
taskType - MAP or REDUCE.
time - timestamp when job failed detected.
error - error message for failure.

logFailed

public static void logFailed(TaskID taskId,
                             String taskType,
                             long time,
                             String error,
                             TaskAttemptID failedDueToAttempt)
Parameters:
failedDueToAttempt - The attempt that caused the failure, if any

getTaskAttempts

public Map<String,JobHistory.TaskAttempt> getTaskAttempts()
Returns all task attempts for this task.


get

public String get(JobHistory.Keys k)
Get 'String' value for given key. Most of the places use Strings as values so the default get' method returns 'String'. This method never returns null to ease on GUIs. if no value is found it returns empty string ""

Parameters:
k -
Returns:
if null it returns empty string - ""

getInt

public int getInt(JobHistory.Keys k)
Convert value from history to int and return. if no value is found it returns 0.

Parameters:
k - key

getLong

public long getLong(JobHistory.Keys k)
Convert value from history to int and return. if no value is found it returns 0.

Parameters:
k -

set

public void set(JobHistory.Keys k,
                String s)
Set value for the key.

Parameters:
k -
s -

set

public void set(Map<JobHistory.Keys,String> m)
Adds all values in the Map argument to its own values.

Parameters:
m -

handle

public void handle(Map<JobHistory.Keys,String> values)
Reads values back from the history, input is same Map as passed to Listener by parseHistory().

Parameters:
values -

getValues

public Map<JobHistory.Keys,String> getValues()
Returns Map containing all key-values.



Copyright © 2009 The Apache Software Foundation