public class HadoopMapReduceCommitProtocol extends FileCommitProtocol implements scala.Serializable
FileCommitProtocol
implementation backed by an underlying Hadoop OutputCommitter
(from the newer mapreduce API, not the old mapred API).
Unlike Hadoop's OutputCommitter, this implementation is serializable.
FileCommitProtocol.EmptyTaskCommitMessage$, FileCommitProtocol.TaskCommitMessage
Constructor and Description |
---|
HadoopMapReduceCommitProtocol(String jobId,
String path) |
Modifier and Type | Method and Description |
---|---|
void |
abortJob(org.apache.hadoop.mapreduce.JobContext jobContext)
Aborts a job after the writes fail.
|
void |
abortTask(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
Aborts a task after the writes have failed.
|
void |
commitJob(org.apache.hadoop.mapreduce.JobContext jobContext,
scala.collection.Seq<FileCommitProtocol.TaskCommitMessage> taskCommits)
Commits a job after the writes succeed.
|
FileCommitProtocol.TaskCommitMessage |
commitTask(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
Commits a task after the writes succeed.
|
String |
newTaskTempFile(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext,
scala.Option<String> dir,
String ext)
Notifies the commit protocol to add a new file, and gets back the full path that should be
used.
|
String |
newTaskTempFileAbsPath(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext,
String absoluteDir,
String ext)
Similar to newTaskTempFile(), but allows files to committed to an absolute output location.
|
void |
setupJob(org.apache.hadoop.mapreduce.JobContext jobContext)
Setups up a job.
|
void |
setupTask(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
Sets up a task within a job.
|
instantiate
public HadoopMapReduceCommitProtocol(String jobId, String path)
public String newTaskTempFile(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext, scala.Option<String> dir, String ext)
FileCommitProtocol
Note that the returned temp file may have an arbitrary path. The commit protocol only promises that the file will be at the location specified by the arguments after job commit.
A full file path consists of the following parts: 1. the base path 2. some sub-directory within the base path, used to specify partitioning 3. file prefix, usually some unique job id with the task id 4. bucket id 5. source specific file extension, e.g. ".snappy.parquet"
The "dir" parameter specifies 2, and "ext" parameter specifies both 4 and 5, and the rest are left to the commit protocol implementation to decide.
Important: it is the caller's responsibility to add uniquely identifying content to "ext" if a task is going to write out multiple files to the same dir. The file commit protocol only guarantees that files written by different tasks will not conflict.
newTaskTempFile
in class FileCommitProtocol
taskContext
- (undocumented)dir
- (undocumented)ext
- (undocumented)public String newTaskTempFileAbsPath(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext, String absoluteDir, String ext)
FileCommitProtocol
Important: it is the caller's responsibility to add uniquely identifying content to "ext" if a task is going to write out multiple files to the same dir. The file commit protocol only guarantees that files written by different tasks will not conflict.
newTaskTempFileAbsPath
in class FileCommitProtocol
taskContext
- (undocumented)absoluteDir
- (undocumented)ext
- (undocumented)public void setupJob(org.apache.hadoop.mapreduce.JobContext jobContext)
FileCommitProtocol
setupJob
in class FileCommitProtocol
jobContext
- (undocumented)public void commitJob(org.apache.hadoop.mapreduce.JobContext jobContext, scala.collection.Seq<FileCommitProtocol.TaskCommitMessage> taskCommits)
FileCommitProtocol
commitJob
in class FileCommitProtocol
jobContext
- (undocumented)taskCommits
- (undocumented)public void abortJob(org.apache.hadoop.mapreduce.JobContext jobContext)
FileCommitProtocol
Calling this function is a best-effort attempt, because it is possible that the driver just crashes (or killed) before it can call abort.
abortJob
in class FileCommitProtocol
jobContext
- (undocumented)public void setupTask(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
FileCommitProtocol
setupTask
in class FileCommitProtocol
taskContext
- (undocumented)public FileCommitProtocol.TaskCommitMessage commitTask(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
FileCommitProtocol
commitTask
in class FileCommitProtocol
taskContext
- (undocumented)public void abortTask(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
FileCommitProtocol
Calling this function is a best-effort attempt, because it is possible that the executor just crashes (or killed) before it can call abort.
abortTask
in class FileCommitProtocol
taskContext
- (undocumented)