Package org.apache.hadoop.mapred
Class FileOutputCommitter
java.lang.Object
org.apache.hadoop.mapreduce.OutputCommitter
org.apache.hadoop.mapred.OutputCommitter
org.apache.hadoop.mapred.FileOutputCommitter
An
OutputCommitter that commits files specified
in job output directory i.e. ${mapreduce.output.fileoutputformat.outputdir}.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabortJob(JobContext context, int runState) For aborting an unsuccessful job's output.voidabortTask(TaskAttemptContext context) Discard the task output.voidcleanupJob(JobContext context) Deprecated.voidcommitJob(JobContext context) For committing job's output after successful job completion.voidcommitTask(TaskAttemptContext context) To promote the task's temporary output to final output location.getTaskAttemptPath(TaskAttemptContext context) getWorkPath(TaskAttemptContext context, Path outputPath) booleanisCommitJobRepeatable(JobContext context) Returns true if an in-progress job commit can be retried.booleanDeprecated.booleanisRecoverySupported(JobContext context) Is task output recovery supported for restarting jobs?booleanneedsTaskCommit(TaskAttemptContext context) Check whether task needs a commit.voidrecoverTask(TaskAttemptContext context) Recover the task output.voidsetupJob(JobContext context) For the framework to setup the job output during initialization.voidsetupTask(TaskAttemptContext context) Sets up output for the task.Methods inherited from class org.apache.hadoop.mapred.OutputCommitter
abortJob, abortTask, cleanupJob, commitJob, commitTask, isCommitJobRepeatable, isRecoverySupported, needsTaskCommit, recoverTask, setupJob, setupTask
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
TEMP_DIR_NAME
Temporary directory name- See Also:
-
SUCCEEDED_FILE_NAME
- See Also:
-
-
Constructor Details
-
FileOutputCommitter
public FileOutputCommitter()
-
-
Method Details
-
getTaskAttemptPath
- Throws:
IOException
-
getWorkPath
- Throws:
IOException
-
setupJob
Description copied from class:OutputCommitterFor the framework to setup the job output during initialization. This is called from the application master process for the entire job. This will be called multiple times, once per job attempt.- Specified by:
setupJobin classOutputCommitter- Parameters:
context- Context of the job whose output is being written.- Throws:
IOException- if temporary output could not be created
-
commitJob
Description copied from class:OutputCommitterFor committing job's output after successful job completion. Note that this is invoked for jobs with final runstate as SUCCESSFUL. This is called from the application master process for the entire job. This is guaranteed to only be called once. If it throws an exception the entire job will fail.- Overrides:
commitJobin classOutputCommitter- Parameters:
context- Context of the job whose output is being written.- Throws:
IOException
-
cleanupJob
Deprecated.Description copied from class:OutputCommitterFor cleaning up the job's output after job completion. This is called from the application master process for the entire job. This may be called multiple times.- Overrides:
cleanupJobin classOutputCommitter- Parameters:
context- Context of the job whose output is being written.- Throws:
IOException
-
abortJob
Description copied from class:OutputCommitterFor aborting an unsuccessful job's output. Note that this is invoked for jobs with final runstate asJobStatus.FAILEDorJobStatus.KILLED. This is called from the application master process for the entire job. This may be called multiple times.- Overrides:
abortJobin classOutputCommitter- Parameters:
context- Context of the job whose output is being written.runState- final runstate of the job- Throws:
IOException
-
setupTask
Description copied from class:OutputCommitterSets up output for the task. This is called from each individual task's process that will output to HDFS, and it is called just for that task. This may be called multiple times for the same task, but for different task attempts.- Specified by:
setupTaskin classOutputCommitter- Parameters:
context- Context of the task whose output is being written.- Throws:
IOException
-
commitTask
Description copied from class:OutputCommitterTo promote the task's temporary output to final output location. IfOutputCommitter.needsTaskCommit(TaskAttemptContext)returns true and this task is the task that the AM determines finished first, this method is called to commit an individual task's output. This is to mark that tasks output as complete, asOutputCommitter.commitJob(JobContext)will also be called later on if the entire job finished successfully. This is called from a task's process. This may be called multiple times for the same task, but different task attempts. It should be very rare for this to be called multiple times and requires odd networking failures to make this happen. In the future the Hadoop framework may eliminate this race.- Specified by:
commitTaskin classOutputCommitter- Parameters:
context- Context of the task whose output is being written.- Throws:
IOException- if commit is not
-
abortTask
Description copied from class:OutputCommitterDiscard the task output. This is called from a task's process to clean up a single task's output that can not yet been committed. This may be called multiple times for the same task, but for different task attempts.- Specified by:
abortTaskin classOutputCommitter- Throws:
IOException
-
needsTaskCommit
Description copied from class:OutputCommitterCheck whether task needs a commit. This is called from each individual task's process that will output to HDFS, and it is called just for that task.- Specified by:
needsTaskCommitin classOutputCommitter- Returns:
- true/false
- Throws:
IOException
-
isRecoverySupported
Deprecated.Description copied from class:OutputCommitterThis method implements the new interface by calling the old method. Note that the input types are different between the new and old apis and this is a bridge between the two.- Overrides:
isRecoverySupportedin classOutputCommitter- Returns:
trueif task output recovery is supported,falseotherwise- See Also:
-
isCommitJobRepeatable
Description copied from class:OutputCommitterReturns true if an in-progress job commit can be retried. If the MR AM is re-run then it will check this value to determine if it can retry an in-progress commit that was started by a previous version. Note that in rare scenarios, the previous AM version might still be running at that time, due to system anomalies. Hence if this method returns true then the retry commit operation should be able to run concurrently with the previous operation. If repeatable job commit is supported, job restart can tolerate previous AM failures during job commit. By default, it is not supported. Extended classes (like: FileOutputCommitter) should explicitly override it if provide support.- Overrides:
isCommitJobRepeatablein classOutputCommitter- Parameters:
context- Context of the job whose output is being written.- Returns:
truerepeatable job commit is supported,falseotherwise- Throws:
IOException
-
isRecoverySupported
Description copied from class:OutputCommitterIs task output recovery supported for restarting jobs? If task output recovery is supported, job restart can be done more efficiently.- Overrides:
isRecoverySupportedin classOutputCommitter- Parameters:
context- Context of the job whose output is being written.- Returns:
trueif task output recovery is supported,falseotherwise- Throws:
IOException- See Also:
-
recoverTask
Description copied from class:OutputCommitterRecover the task output. The retry-count for the job will be passed via theMRConstants.APPLICATION_ATTEMPT_IDkey inJobContext.getConfiguration()for theOutputCommitter. This is called from the application master process, but it is called individually for each task. If an exception is thrown the task will be attempted again.- Overrides:
recoverTaskin classOutputCommitter- Parameters:
context- Context of the task whose output is being recovered- Throws:
IOException
-