org.apache.hadoop.mapred
Class JobHistory.JobInfo

java.lang.Object
  extended by org.apache.hadoop.mapred.JobHistory.JobInfo
Enclosing class:
JobHistory

public static class JobHistory.JobInfo
extends Object

Helper class for logging or reading back events related to job start, finish or failure.


Constructor Summary
JobHistory.JobInfo(String jobId)
          Create new JobInfo
 
Method Summary
 String get(JobHistory.Keys k)
          Get 'String' value for given key.
 Map<String,JobHistory.Task> getAllTasks()
          Returns all map and reduce tasks .
 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<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(String jobid, long timestamp, int finishedMaps, int finishedReduces)
          Logs job failed event.
static void logFinished(String jobId, long finishTime, int finishedMaps, int finishedReduces, int failedMaps, int failedReduces)
          Log job finished.
static void logStarted(String jobId, long startTime, int totalMaps, int totalReduces)
          Logs launch time of job.
static void logSubmitted(String jobId, String jobName, String user, long submitTime, String jobConf)
          Log job submitted event to history.
 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.JobInfo

public JobHistory.JobInfo(String jobId)
Create new JobInfo

Method Detail

getAllTasks

public Map<String,JobHistory.Task> getAllTasks()
Returns all map and reduce tasks .


logSubmitted

public static void logSubmitted(String jobId,
                                String jobName,
                                String user,
                                long submitTime,
                                String jobConf)
Log job submitted event to history. Creates a new file in history for the job. if history file creation fails, it disables history for all other events.

Parameters:
jobId - job id assigned by job tracker.
jobName - job name as given by user in job conf
user - user name
submitTime - time when job tracker received the job
jobConf - path to job conf xml file in HDFS.

logStarted

public static void logStarted(String jobId,
                              long startTime,
                              int totalMaps,
                              int totalReduces)
Logs launch time of job.

Parameters:
jobId - job id, assigned by jobtracker.
startTime - start time of job.
totalMaps - total maps assigned by jobtracker.
totalReduces - total reduces.

logFinished

public static void logFinished(String jobId,
                               long finishTime,
                               int finishedMaps,
                               int finishedReduces,
                               int failedMaps,
                               int failedReduces)
Log job finished. closes the job file in history.

Parameters:
jobId - job id, assigned by jobtracker.
finishTime - finish time of job in ms.
finishedMaps - no of maps successfully finished.
finishedReduces - no of reduces finished sucessfully.
failedMaps - no of failed map tasks.
failedReduces - no of failed reduce tasks.

logFailed

public static void logFailed(String jobid,
                             long timestamp,
                             int finishedMaps,
                             int finishedReduces)
Logs job failed event. Closes the job history log file.

Parameters:
jobid - job id
timestamp - time when job failure was detected in ms.
finishedMaps - no finished map tasks.
finishedReduces - no of finished reduce tasks.

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 © 2006 The Apache Software Foundation