org.apache.hadoop.mapred
Class JobHistory

java.lang.Object
  extended by org.apache.hadoop.mapred.JobHistory

public class JobHistory
extends Object

Provides methods for writing to and reading from job history. Job History works in an append mode, JobHistory and its inner classes provide methods to log job events. JobHistory is split into multiple files, format of each file is plain text where each line is of the format [type (key=value)*], where type identifies the type of the record. Type maps to UID of one of the inner classes of this class. Job history is maintained in a master index which contains star/stop times of all jobs with a few other job level properties. Apart from this each job's history is maintained in a seperate history file. name of job history files follows the format jobtrackerId_jobid For parsing the job history it supports a listener based interface where each line is parsed and passed to listener. The listener can create an object model of history or look for specific events and discard rest of the history.


Nested Class Summary
static class JobHistory.HistoryCleaner
          Delete history files older than one month.
static class JobHistory.JobInfo
          Helper class for logging or reading back events related to job start, finish or failure.
static class JobHistory.Keys
          Job history files contain key="value" pairs, where keys belong to this enum.
static interface JobHistory.Listener
          Callback interface for reading back log events from JobHistory.
static class JobHistory.MapAttempt
          Helper class for logging or reading back events related to start, finish or failure of a Map Attempt on a node.
static class JobHistory.RecordTypes
          Record types are identifiers for each line of log in history files.
static class JobHistory.ReduceAttempt
          Helper class for logging or reading back events related to start, finish or failure of a Map Attempt on a node.
static class JobHistory.Task
          Helper class for logging or reading back events related to Task's start, finish or failure.
static class JobHistory.TaskAttempt
          Base class for Map and Reduce TaskAttempts.
static class JobHistory.Values
          This enum contains some of the values commonly used by history log events.
 
Field Summary
static String JOBTRACKER_START_TIME
           
static org.apache.commons.logging.Log LOG
           
static String MASTER_INDEX_LOG_FILE
           
 
Constructor Summary
JobHistory()
           
 
Method Summary
static boolean isDisableHistory()
          Returns history disable status.
static void parseHistory(File path, JobHistory.Listener l)
          Parses history file and invokes Listener.handle() for each line of history.
static void setDisableHistory(boolean disableHistory)
          Enable/disable history logging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

JOBTRACKER_START_TIME

public static final String JOBTRACKER_START_TIME

MASTER_INDEX_LOG_FILE

public static final String MASTER_INDEX_LOG_FILE
See Also:
Constant Field Values
Constructor Detail

JobHistory

public JobHistory()
Method Detail

parseHistory

public static void parseHistory(File path,
                                JobHistory.Listener l)
                         throws IOException
Parses history file and invokes Listener.handle() for each line of history. It can be used for looking through history files for specific items without having to keep whlole history in memory.

Parameters:
path - path to history file
l - Listener for history events
Throws:
IOException

isDisableHistory

public static boolean isDisableHistory()
Returns history disable status. by default history is enabled so this method returns false.

Returns:
true if history logging is disabled, false otherwise.

setDisableHistory

public static void setDisableHistory(boolean disableHistory)
Enable/disable history logging. Default value is false, so history is enabled by default.

Parameters:
disableHistory - true if history should be disabled, false otherwise.


Copyright © 2006 The Apache Software Foundation