@InterfaceAudience.Public @InterfaceStability.Unstable public class BindingPathOutputCommitter extends PathOutputCommitter implements org.apache.hadoop.fs.statistics.IOStatisticsSource, StreamCapabilities
NAME
). When this class is instantiated, it will
use the factory mechanism to locate the configured committer for the
destination.
Modifier and Type | Field and Description |
---|---|
static String |
NAME
The classname for use in configurations.
|
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO
Constructor and Description |
---|
BindingPathOutputCommitter(Path outputPath,
TaskAttemptContext context)
Instantiate.
|
Modifier and Type | Method and Description |
---|---|
void |
abortJob(JobContext jobContext,
org.apache.hadoop.mapreduce.JobStatus.State state)
For aborting an unsuccessful job's output.
|
void |
abortTask(TaskAttemptContext taskContext)
Discard the task output.
|
void |
cleanupJob(JobContext jobContext)
For cleaning up the job's output after job completion.
|
void |
commitJob(JobContext jobContext)
For committing job's output after successful job completion.
|
void |
commitTask(TaskAttemptContext taskContext)
To promote the task's temporary output to final output location.
|
PathOutputCommitter |
getCommitter()
Get the inner committer.
|
IOStatistics |
getIOStatistics()
Return a statistics instance.
|
Path |
getOutputPath()
Get the final directory where work will be placed once the job
is committed.
|
Path |
getWorkPath()
Get the directory that the task should write results into.
|
boolean |
hasCapability(String capability)
Pass through if the inner committer supports StreamCapabilities.
|
boolean |
hasOutputPath()
Predicate: is there an output path?
|
boolean |
isCommitJobRepeatable(JobContext jobContext)
Returns true if an in-progress job commit can be retried.
|
boolean |
isRecoverySupported()
Is task output recovery supported for restarting jobs?
If task output recovery is supported, job restart can be done more
efficiently.
|
boolean |
isRecoverySupported(JobContext jobContext)
Is task output recovery supported for restarting jobs?
If task output recovery is supported, job restart can be done more
efficiently.
|
boolean |
needsTaskCommit(TaskAttemptContext taskContext)
Check whether task needs a commit.
|
void |
recoverTask(TaskAttemptContext taskContext)
Recover the task output.
|
void |
setupJob(JobContext jobContext)
For the framework to setup the job output during initialization.
|
void |
setupTask(TaskAttemptContext taskContext)
Sets up output for the task.
|
String |
toString() |
public static final String NAME
public BindingPathOutputCommitter(Path outputPath, TaskAttemptContext context) throws IOException
outputPath
- output path (may be null)context
- task contextIOException
- on any failure.public Path getOutputPath()
PathOutputCommitter
getOutputPath
in class PathOutputCommitter
public Path getWorkPath() throws IOException
PathOutputCommitter
getWorkPath
in class PathOutputCommitter
IOException
- IO problempublic void setupJob(JobContext jobContext) throws IOException
OutputCommitter
setupJob
in class OutputCommitter
jobContext
- Context of the job whose output is being written.IOException
- if temporary output could not be createdpublic void setupTask(TaskAttemptContext taskContext) throws IOException
OutputCommitter
setupTask
in class OutputCommitter
taskContext
- Context of the task whose output is being written.IOException
public boolean needsTaskCommit(TaskAttemptContext taskContext) throws IOException
OutputCommitter
needsTaskCommit
in class OutputCommitter
IOException
public void commitTask(TaskAttemptContext taskContext) throws IOException
OutputCommitter
OutputCommitter.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, as OutputCommitter.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.commitTask
in class OutputCommitter
taskContext
- Context of the task whose output is being written.IOException
- if commit is not successful.public void abortTask(TaskAttemptContext taskContext) throws IOException
OutputCommitter
abortTask
in class OutputCommitter
IOException
public void cleanupJob(JobContext jobContext) throws IOException
OutputCommitter
cleanupJob
in class OutputCommitter
jobContext
- Context of the job whose output is being written.IOException
public void commitJob(JobContext jobContext) throws IOException
OutputCommitter
commitJob
in class OutputCommitter
jobContext
- Context of the job whose output is being written.IOException
public void abortJob(JobContext jobContext, org.apache.hadoop.mapreduce.JobStatus.State state) throws IOException
OutputCommitter
JobStatus.State.FAILED
or
JobStatus.State.KILLED
. This is called from the application
master process for the entire job. This may be called multiple times.abortJob
in class OutputCommitter
jobContext
- Context of the job whose output is being written.state
- final runstate of the jobIOException
public boolean isRecoverySupported()
OutputCommitter
isRecoverySupported
in class OutputCommitter
true
if task output recovery is supported,
false
otherwiseOutputCommitter.recoverTask(TaskAttemptContext)
public boolean isCommitJobRepeatable(JobContext jobContext) throws IOException
OutputCommitter
isCommitJobRepeatable
in class OutputCommitter
jobContext
- Context of the job whose output is being written.true
repeatable job commit is supported,
false
otherwiseIOException
public boolean isRecoverySupported(JobContext jobContext) throws IOException
OutputCommitter
isRecoverySupported
in class OutputCommitter
jobContext
- Context of the job whose output is being written.true
if task output recovery is supported,
false
otherwiseIOException
OutputCommitter.recoverTask(TaskAttemptContext)
public void recoverTask(TaskAttemptContext taskContext) throws IOException
OutputCommitter
MRJobConfig.APPLICATION_ATTEMPT_ID
key in
JobContext.getConfiguration()
for the
OutputCommitter
. 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.
This may be called multiple times for the same task. But from different
application attempts.recoverTask
in class OutputCommitter
taskContext
- Context of the task whose output is being recoveredIOException
public boolean hasOutputPath()
PathOutputCommitter
hasOutputPath
in class PathOutputCommitter
public String toString()
toString
in class PathOutputCommitter
public PathOutputCommitter getCommitter()
public boolean hasCapability(String capability)
hasCapability
in interface StreamCapabilities
capability
- string to query the stream support for.public IOStatistics getIOStatistics()
org.apache.hadoop.fs.statistics.IOStatisticsSource
It is not a requirement that the same instance is returned every time.
IOStatisticsSource
.
If the object implementing this is Closeable, this method may return null if invoked on a closed object, even if it returns a valid instance when called earlier.
getIOStatistics
in interface org.apache.hadoop.fs.statistics.IOStatisticsSource
Copyright © 2023 Apache Software Foundation. All rights reserved.