org.apache.hadoop.mapred
Class FileOutputCommitter

java.lang.Object
  extended by org.apache.hadoop.mapreduce.OutputCommitter
      extended by org.apache.hadoop.mapred.OutputCommitter
          extended by org.apache.hadoop.mapred.FileOutputCommitter

@InterfaceAudience.Public
@InterfaceStability.Stable
public class FileOutputCommitter
extends OutputCommitter

An OutputCommitter that commits files specified in job output directory i.e. ${mapreduce.output.fileoutputformat.outputdir}.


Field Summary
static org.apache.commons.logging.Log LOG
           
static String SUCCEEDED_FILE_NAME
           
static String TEMP_DIR_NAME
          Temporary directory name
 
Constructor Summary
FileOutputCommitter()
           
 
Method Summary
 void abortJob(JobContext context, int runState)
          For aborting an unsuccessful job's output.
 void abortTask(TaskAttemptContext context)
          Discard the task output
 void cleanupJob(JobContext context)
          Deprecated. 
 void commitJob(JobContext context)
          For committing job's output after successful job completion.
 void commitTask(TaskAttemptContext context)
          To promote the task's temporary output to final output location The task's output is moved to the job's output directory.
 org.apache.hadoop.fs.Path getWorkPath(TaskAttemptContext context, org.apache.hadoop.fs.Path outputPath)
           
 boolean isRecoverySupported()
          This method implements the new interface by calling the old method.
 boolean needsTaskCommit(TaskAttemptContext context)
          Check whether task needs a commit
 void recoverTask(TaskAttemptContext context)
          Recover the task output.
 void setupJob(JobContext context)
          For the framework to setup the job output during initialization
 void setupTask(TaskAttemptContext context)
          Sets up output for the task.
 
Methods inherited from class org.apache.hadoop.mapred.OutputCommitter
abortJob, abortTask, cleanupJob, commitJob, commitTask, needsTaskCommit, recoverTask, setupJob, setupTask
 
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

TEMP_DIR_NAME

public static final String TEMP_DIR_NAME
Temporary directory name

See Also:
Constant Field Values

SUCCEEDED_FILE_NAME

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

FileOutputCommitter

public FileOutputCommitter()
Method Detail

getWorkPath

public org.apache.hadoop.fs.Path getWorkPath(TaskAttemptContext context,
                                             org.apache.hadoop.fs.Path outputPath)
                                      throws IOException
Throws:
IOException

setupJob

public void setupJob(JobContext context)
              throws IOException
Description copied from class: OutputCommitter
For the framework to setup the job output during initialization

Specified by:
setupJob in class OutputCommitter
Parameters:
context - Context of the job whose output is being written.
Throws:
IOException - if temporary output could not be created

commitJob

public void commitJob(JobContext context)
               throws IOException
Description copied from class: OutputCommitter
For committing job's output after successful job completion. Note that this is invoked for jobs with final runstate as SUCCESSFUL.

Overrides:
commitJob in class OutputCommitter
Parameters:
context - Context of the job whose output is being written.
Throws:
IOException

cleanupJob

@Deprecated
public void cleanupJob(JobContext context)
                throws IOException
Deprecated. 

Description copied from class: OutputCommitter
For cleaning up the job's output after job completion

Overrides:
cleanupJob in class OutputCommitter
Parameters:
context - Context of the job whose output is being written.
Throws:
IOException

abortJob

public void abortJob(JobContext context,
                     int runState)
              throws IOException
Description copied from class: OutputCommitter
For aborting an unsuccessful job's output. Note that this is invoked for jobs with final runstate as JobStatus.FAILED or JobStatus.KILLED

Overrides:
abortJob in class OutputCommitter
Parameters:
context - Context of the job whose output is being written.
runState - final runstate of the job
Throws:
IOException

setupTask

public void setupTask(TaskAttemptContext context)
               throws IOException
Description copied from class: OutputCommitter
Sets up output for the task.

Specified by:
setupTask in class OutputCommitter
Parameters:
context - Context of the task whose output is being written.
Throws:
IOException

commitTask

public void commitTask(TaskAttemptContext context)
                throws IOException
Description copied from class: OutputCommitter
To promote the task's temporary output to final output location The task's output is moved to the job's output directory.

Specified by:
commitTask in class OutputCommitter
Parameters:
context - Context of the task whose output is being written.
Throws:
IOException - if commit is not

abortTask

public void abortTask(TaskAttemptContext context)
               throws IOException
Description copied from class: OutputCommitter
Discard the task output

Specified by:
abortTask in class OutputCommitter
Throws:
IOException

needsTaskCommit

public boolean needsTaskCommit(TaskAttemptContext context)
                        throws IOException
Description copied from class: OutputCommitter
Check whether task needs a commit

Specified by:
needsTaskCommit in class OutputCommitter
Returns:
true/false
Throws:
IOException

isRecoverySupported

public boolean isRecoverySupported()
Description copied from class: OutputCommitter
This 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:
isRecoverySupported in class OutputCommitter
Returns:
true if task output recovery is supported, false otherwise
See Also:
OutputCommitter.recoverTask(TaskAttemptContext)

recoverTask

public void recoverTask(TaskAttemptContext context)
                 throws IOException
Description copied from class: OutputCommitter
Recover the task output. The retry-count for the job will be passed via the MRConstants.APPLICATION_ATTEMPT_ID key in JobContext.getConfiguration() for the OutputCommitter. If an exception is thrown the task will be attempted again.

Overrides:
recoverTask in class OutputCommitter
Parameters:
context - Context of the task whose output is being recovered
Throws:
IOException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.