Class JobHistoryEventHandler
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service,org.apache.hadoop.yarn.event.EventHandler<JobHistoryEvent>
public class JobHistoryEventHandler
extends org.apache.hadoop.service.AbstractService
implements org.apache.hadoop.yarn.event.EventHandler<JobHistoryEvent>
The job history events get routed to this class. This class writes the Job
history events to the DFS directly into a staging dir and then moved to a
done-dir. JobHistory implementation is in this package to access package
private classes.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.hadoop.yarn.event.AsyncDispatcherprotected Threadprotected BlockingQueue<JobHistoryEvent>protected static final Map<org.apache.hadoop.mapreduce.v2.api.records.JobId,JobHistoryEventHandler.MetaInfo> protected booleanprotected booleanprotected org.apache.hadoop.yarn.client.api.TimelineClientprotected org.apache.hadoop.yarn.client.api.TimelineV2Client -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseEventWriter(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) voidcloseWriter(org.apache.hadoop.mapreduce.v2.api.records.JobId id) Close the event writer for this idprotected org.apache.hadoop.yarn.event.AsyncDispatcherprotected org.apache.hadoop.mapreduce.jobhistory.EventWritercreateEventWriter(org.apache.hadoop.fs.Path historyFilePath) voidhandle(JobHistoryEvent event) voidhandleEvent(JobHistoryEvent event) protected voidmoveTmpToDone(org.apache.hadoop.fs.Path tmpPath) protected booleanmoveToDoneNow(org.apache.hadoop.fs.Path fromPath, org.apache.hadoop.fs.Path toPath) protected voidprocessDoneFiles(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) voidprocessEventForJobSummary(org.apache.hadoop.mapreduce.jobhistory.HistoryEvent event, JobSummary summary, org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidvoidsetForcejobCompletion(boolean forceJobCompletion) protected voidsetupEventWriter(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId, org.apache.hadoop.mapreduce.jobhistory.AMStartedEvent amStartedEvent) Create an event writer for the Job represented by the jobID.Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
eventQueue
-
handleTimelineEvent
protected boolean handleTimelineEvent -
atsEventDispatcher
protected org.apache.hadoop.yarn.event.AsyncDispatcher atsEventDispatcher -
eventHandlingThread
-
fileMap
protected static final Map<org.apache.hadoop.mapreduce.v2.api.records.JobId,JobHistoryEventHandler.MetaInfo> fileMap -
forceJobCompletion
protected volatile boolean forceJobCompletion -
timelineClient
@VisibleForTesting protected org.apache.hadoop.yarn.client.api.TimelineClient timelineClient -
timelineV2Client
@VisibleForTesting protected org.apache.hadoop.yarn.client.api.TimelineV2Client timelineV2Client
-
-
Constructor Details
-
JobHistoryEventHandler
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
createDispatcher
protected org.apache.hadoop.yarn.event.AsyncDispatcher createDispatcher() -
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
createEventWriter
protected org.apache.hadoop.mapreduce.jobhistory.EventWriter createEventWriter(org.apache.hadoop.fs.Path historyFilePath) throws IOException - Throws:
IOException
-
setupEventWriter
protected void setupEventWriter(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId, org.apache.hadoop.mapreduce.jobhistory.AMStartedEvent amStartedEvent) throws IOException Create an event writer for the Job represented by the jobID. Writes out the job configuration to the log directory. This should be the first call to history for a job- Parameters:
jobId- the jobId.amStartedEvent-- Throws:
IOException
-
closeWriter
Close the event writer for this id- Throws:
IOException
-
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<JobHistoryEvent>
-
handleEvent
-
processEventForJobSummary
public void processEventForJobSummary(org.apache.hadoop.mapreduce.jobhistory.HistoryEvent event, JobSummary summary, org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) -
closeEventWriter
protected void closeEventWriter(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) throws IOException - Throws:
IOException
-
processDoneFiles
protected void processDoneFiles(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId) throws IOException - Throws:
IOException
-
moveTmpToDone
- Throws:
IOException
-
moveToDoneNow
protected boolean moveToDoneNow(org.apache.hadoop.fs.Path fromPath, org.apache.hadoop.fs.Path toPath) throws IOException - Throws:
IOException
-
setForcejobCompletion
public void setForcejobCompletion(boolean forceJobCompletion)
-