public class JobLogger extends java.lang.Object implements SparkListener, Logging
NOTE: The functionality of this class is heavily stripped down to accommodate for a general refactor of the SparkListener interface. In its place, the EventLoggingListener is introduced to log application information as SparkListenerEvents. To enable this functionality, set spark.eventLog.enabled to true.
| Constructor and Description |
|---|
JobLogger() |
JobLogger(java.lang.String user,
java.lang.String logDirName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildJobStageDependencies(int jobId,
scala.collection.Seq<java.lang.Object> stageIds)
Build up the maps that represent stage-job relationships
|
protected void |
closeLogWriter(int jobId)
Close log file, and clean the stage relationship in stageIdToJobId
|
protected void |
createLogDir()
Create a folder for log files, the folder's name is the creation time of jobLogger
|
protected void |
createLogWriter(int jobId)
Create a log file for one job
|
protected void |
jobLogInfo(int jobId,
java.lang.String info,
boolean withTime)
Write info into log file
|
java.lang.String |
logDirName() |
void |
onJobEnd(SparkListenerJobEnd jobEnd)
When job ends, recording job completion status and close log file
|
void |
onJobStart(SparkListenerJobStart jobStart)
When job starts, record job property and stage graph
|
void |
onStageCompleted(SparkListenerStageCompleted stageCompleted)
When stage is completed, record stage completion status
|
void |
onStageSubmitted(SparkListenerStageSubmitted stageSubmitted)
When stage is submitted, record stage submit info
|
void |
onTaskEnd(SparkListenerTaskEnd taskEnd)
When task ends, record task completion status and metrics
|
protected void |
recordJobProperties(int jobId,
java.util.Properties properties)
Record job properties into job log file
|
protected void |
recordTaskMetrics(int stageId,
java.lang.String status,
TaskInfo taskInfo,
org.apache.spark.executor.TaskMetrics taskMetrics)
Record task metrics into job log files, including execution info and shuffle metrics
|
protected void |
stageLogInfo(int stageId,
java.lang.String info,
boolean withTime)
Write info into log file
|
java.lang.String |
user() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonApplicationEnd, onApplicationStart, onBlockManagerAdded, onBlockManagerRemoved, onBlockUpdated, onEnvironmentUpdate, onExecutorAdded, onExecutorMetricsUpdate, onExecutorRemoved, onTaskGettingResult, onTaskStart, onUnpersistRDDinitializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarningpublic JobLogger(java.lang.String user,
java.lang.String logDirName)
public JobLogger()
public java.lang.String user()
public java.lang.String logDirName()
protected void createLogDir()
protected void createLogWriter(int jobId)
jobId - ID of the jobFileNotFoundException - Fail to create log fileprotected void closeLogWriter(int jobId)
jobId - ID of the jobprotected void buildJobStageDependencies(int jobId,
scala.collection.Seq<java.lang.Object> stageIds)
jobId - ID of the jobstageIds - IDs of the associated stagesprotected void jobLogInfo(int jobId,
java.lang.String info,
boolean withTime)
jobId - ID of the jobinfo - Info to be recordedwithTime - Controls whether to record time stamp before the info, default is trueprotected void stageLogInfo(int stageId,
java.lang.String info,
boolean withTime)
stageId - ID of the stageinfo - Info to be recordedwithTime - Controls whether to record time stamp before the info, default is trueprotected void recordTaskMetrics(int stageId,
java.lang.String status,
TaskInfo taskInfo,
org.apache.spark.executor.TaskMetrics taskMetrics)
stageId - Stage ID of the taskstatus - Status info of the tasktaskInfo - Task description infotaskMetrics - Task running metricspublic void onStageSubmitted(SparkListenerStageSubmitted stageSubmitted)
onStageSubmitted in interface SparkListenerstageSubmitted - Stage submitted eventpublic void onStageCompleted(SparkListenerStageCompleted stageCompleted)
onStageCompleted in interface SparkListenerstageCompleted - Stage completed eventpublic void onTaskEnd(SparkListenerTaskEnd taskEnd)
onTaskEnd in interface SparkListenertaskEnd - Task end eventpublic void onJobEnd(SparkListenerJobEnd jobEnd)
onJobEnd in interface SparkListenerjobEnd - Job end eventprotected void recordJobProperties(int jobId,
java.util.Properties properties)
jobId - ID of the jobproperties - Properties of the jobpublic void onJobStart(SparkListenerJobStart jobStart)
onJobStart in interface SparkListenerjobStart - Job start event