org.apache.hadoop.mapred.TaskAttemptContext Java Examples

The following examples show how to use org.apache.hadoop.mapred.TaskAttemptContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HadoopOutputFormatTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloseWithoutTaskCommit() throws Exception {
	OutputFormat<String, Long> dummyOutputFormat = mock(DummyOutputFormat.class);
	DummyOutputCommitter outputCommitter = mock(DummyOutputCommitter.class);
	when(outputCommitter.needsTaskCommit(any(TaskAttemptContext.class))).thenReturn(false);
	DummyRecordWriter recordWriter = mock(DummyRecordWriter.class);
	JobConf jobConf = mock(JobConf.class);

	HadoopOutputFormat<String, Long> outputFormat = new HadoopOutputFormat<>(dummyOutputFormat, jobConf);
	outputFormat.recordWriter = recordWriter;
	outputFormat.outputCommitter = outputCommitter;

	outputFormat.close();

	verify(recordWriter, times(1)).close(any(Reporter.class));
	verify(outputCommitter, times(0)).commitTask(any(TaskAttemptContext.class));
}
 
Example #2
Source File: HadoopOutputFormatTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloseWithTaskCommit() throws Exception {
	OutputFormat<String, Long> dummyOutputFormat = mock(DummyOutputFormat.class);
	DummyOutputCommitter outputCommitter = mock(DummyOutputCommitter.class);
	when(outputCommitter.needsTaskCommit(nullable(TaskAttemptContext.class))).thenReturn(true);
	DummyRecordWriter recordWriter = mock(DummyRecordWriter.class);
	JobConf jobConf = mock(JobConf.class);

	HadoopOutputFormat<String, Long> outputFormat = new HadoopOutputFormat<>(dummyOutputFormat, jobConf);
	outputFormat.recordWriter = recordWriter;
	outputFormat.outputCommitter = outputCommitter;

	outputFormat.close();

	verify(recordWriter, times(1)).close(nullable(Reporter.class));
	verify(outputCommitter, times(1)).commitTask(nullable(TaskAttemptContext.class));
}
 
Example #3
Source File: HadoopOutputFormatTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloseWithTaskCommit() throws Exception {
	OutputFormat<String, Long> dummyOutputFormat = mock(DummyOutputFormat.class);
	DummyOutputCommitter outputCommitter = mock(DummyOutputCommitter.class);
	when(outputCommitter.needsTaskCommit(nullable(TaskAttemptContext.class))).thenReturn(true);
	DummyRecordWriter recordWriter = mock(DummyRecordWriter.class);
	JobConf jobConf = mock(JobConf.class);

	HadoopOutputFormat<String, Long> outputFormat = new HadoopOutputFormat<>(dummyOutputFormat, jobConf);
	outputFormat.recordWriter = recordWriter;
	outputFormat.outputCommitter = outputCommitter;

	outputFormat.close();

	verify(recordWriter, times(1)).close(nullable(Reporter.class));
	verify(outputCommitter, times(1)).commitTask(nullable(TaskAttemptContext.class));
}
 
Example #4
Source File: HadoopOutputFormatTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloseWithoutTaskCommit() throws Exception {
	OutputFormat<String, Long> dummyOutputFormat = mock(DummyOutputFormat.class);
	DummyOutputCommitter outputCommitter = mock(DummyOutputCommitter.class);
	when(outputCommitter.needsTaskCommit(any(TaskAttemptContext.class))).thenReturn(false);
	DummyRecordWriter recordWriter = mock(DummyRecordWriter.class);
	JobConf jobConf = mock(JobConf.class);

	HadoopOutputFormat<String, Long> outputFormat = new HadoopOutputFormat<>(dummyOutputFormat, jobConf);
	outputFormat.recordWriter = recordWriter;
	outputFormat.outputCommitter = outputCommitter;

	outputFormat.close();

	verify(recordWriter, times(1)).close(any(Reporter.class));
	verify(outputCommitter, times(0)).commitTask(any(TaskAttemptContext.class));
}
 
Example #5
Source File: HadoopOutputFormatTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloseWithTaskCommit() throws Exception {
	OutputFormat<String, Long> dummyOutputFormat = mock(DummyOutputFormat.class);
	DummyOutputCommitter outputCommitter = mock(DummyOutputCommitter.class);
	when(outputCommitter.needsTaskCommit(nullable(TaskAttemptContext.class))).thenReturn(true);
	DummyRecordWriter recordWriter = mock(DummyRecordWriter.class);
	JobConf jobConf = mock(JobConf.class);

	HadoopOutputFormat<String, Long> outputFormat = new HadoopOutputFormat<>(dummyOutputFormat, jobConf);
	outputFormat.recordWriter = recordWriter;
	outputFormat.outputCommitter = outputCommitter;

	outputFormat.close();

	verify(recordWriter, times(1)).close(nullable(Reporter.class));
	verify(outputCommitter, times(1)).commitTask(nullable(TaskAttemptContext.class));
}
 
Example #6
Source File: HadoopOutputFormatTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloseWithoutTaskCommit() throws Exception {
	OutputFormat<String, Long> dummyOutputFormat = mock(DummyOutputFormat.class);
	DummyOutputCommitter outputCommitter = mock(DummyOutputCommitter.class);
	when(outputCommitter.needsTaskCommit(any(TaskAttemptContext.class))).thenReturn(false);
	DummyRecordWriter recordWriter = mock(DummyRecordWriter.class);
	JobConf jobConf = mock(JobConf.class);

	HadoopOutputFormat<String, Long> outputFormat = new HadoopOutputFormat<>(dummyOutputFormat, jobConf);
	outputFormat.recordWriter = recordWriter;
	outputFormat.outputCommitter = outputCommitter;

	outputFormat.close();

	verify(recordWriter, times(1)).close(any(Reporter.class));
	verify(outputCommitter, times(0)).commitTask(any(TaskAttemptContext.class));
}
 
Example #7
Source File: HadoopV1OutputCollector.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Commit task.
 *
 * @throws IOException In failed.
 */
public void commit() throws IOException {
    if (writer != null) {
        OutputCommitter outputCommitter = jobConf.getOutputCommitter();

        TaskAttemptContext taskCtx = new TaskAttemptContextImpl(jobConf, attempt);

        if (outputCommitter.needsTaskCommit(taskCtx))
            outputCommitter.commitTask(taskCtx);
    }
}
 
Example #8
Source File: CustomOutputCommitter.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_COMMIT_FILE_NAME);
}
 
Example #9
Source File: MRTask.java    From tez with Apache License 2.0 4 votes vote down vote up
public org.apache.hadoop.mapreduce.TaskAttemptContext getTaskAttemptContext() {
  return taskAttemptContext;
}
 
Example #10
Source File: CustomOutputCommitter.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void abortTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_ABORT_FILE_NAME);
}
 
Example #11
Source File: HadoopOutputFormatTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskAttemptContext) throws IOException {
	return false;
}
 
Example #12
Source File: BlurHiveMRLoaderOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
}
 
Example #13
Source File: BlurHiveMRLoaderOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext) throws IOException {
  return false;
}
 
Example #14
Source File: BlurHiveMRLoaderOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
}
 
Example #15
Source File: BlurHiveOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
}
 
Example #16
Source File: BlurHiveOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext) throws IOException {
  return false;
}
 
Example #17
Source File: BlurHiveOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
}
 
Example #18
Source File: MRTask.java    From incubator-tez with Apache License 2.0 4 votes vote down vote up
public org.apache.hadoop.mapreduce.TaskAttemptContext getTaskAttemptContext() {
  return taskAttemptContext;
}
 
Example #19
Source File: CustomOutputCommitter.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_SETUP_FILE_NAME);
}
 
Example #20
Source File: CustomOutputCommitter.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void abortTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_ABORT_FILE_NAME);
}
 
Example #21
Source File: CustomOutputCommitter.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_COMMIT_FILE_NAME);
}
 
Example #22
Source File: CustomOutputCommitter.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext)
    throws IOException {
  return true;
}
 
Example #23
Source File: CustomOutputCommitter.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext)
    throws IOException {
  return true;
}
 
Example #24
Source File: CustomOutputCommitter.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_SETUP_FILE_NAME);
}
 
Example #25
Source File: HadoopOutputFormatTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskAttemptContext) throws IOException {
	return false;
}
 
Example #26
Source File: HadoopOutputFormatTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext taskAttemptContext) throws IOException {
	return false;
}
 
Example #27
Source File: HadoopOutputFormatTest.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
@Override
public void setupTask(TaskAttemptContext taskAttemptContext) throws IOException {

}
 
Example #28
Source File: BlurHiveOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 2 votes vote down vote up
@Override
public void abortTask(TaskAttemptContext taskContext) throws IOException {

}
 
Example #29
Source File: HadoopOutputFormatTest.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
@Override
public void commitTask(TaskAttemptContext taskAttemptContext) throws IOException {

}
 
Example #30
Source File: HadoopOutputFormatTest.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
@Override
public void abortTask(TaskAttemptContext taskAttemptContext) throws IOException {

}