类org.apache.hadoop.mapred.TaskAttemptContext源码实例Demo

下面列出了怎么用org.apache.hadoop.mapred.TaskAttemptContext的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Flink-CEPplus   文件: HadoopOutputFormatTest.java
@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));
}
 
源代码2 项目: Flink-CEPplus   文件: HadoopOutputFormatTest.java
@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));
}
 
源代码3 项目: flink   文件: HadoopOutputFormatTest.java
@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));
}
 
源代码4 项目: flink   文件: HadoopOutputFormatTest.java
@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));
}
 
源代码5 项目: flink   文件: HadoopOutputFormatTest.java
@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));
}
 
源代码6 项目: flink   文件: HadoopOutputFormatTest.java
@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));
}
 
源代码7 项目: ignite   文件: HadoopV1OutputCollector.java
/**
 * 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);
    }
}
 
源代码8 项目: Flink-CEPplus   文件: HadoopOutputFormatTest.java
@Override
public boolean needsTaskCommit(TaskAttemptContext taskAttemptContext) throws IOException {
	return false;
}
 
源代码9 项目: flink   文件: HadoopOutputFormatTest.java
@Override
public boolean needsTaskCommit(TaskAttemptContext taskAttemptContext) throws IOException {
	return false;
}
 
源代码10 项目: hadoop   文件: CustomOutputCommitter.java
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_SETUP_FILE_NAME);
}
 
源代码11 项目: hadoop   文件: CustomOutputCommitter.java
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext)
    throws IOException {
  return true;
}
 
源代码12 项目: hadoop   文件: CustomOutputCommitter.java
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_COMMIT_FILE_NAME);
}
 
源代码13 项目: hadoop   文件: CustomOutputCommitter.java
@Override
public void abortTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_ABORT_FILE_NAME);
}
 
源代码14 项目: big-c   文件: CustomOutputCommitter.java
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_SETUP_FILE_NAME);
}
 
源代码15 项目: big-c   文件: CustomOutputCommitter.java
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext)
    throws IOException {
  return true;
}
 
源代码16 项目: big-c   文件: CustomOutputCommitter.java
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_COMMIT_FILE_NAME);
}
 
源代码17 项目: big-c   文件: CustomOutputCommitter.java
@Override
public void abortTask(TaskAttemptContext taskContext) throws IOException {
  writeFile(taskContext.getJobConf(), TASK_ABORT_FILE_NAME);
}
 
源代码18 项目: flink   文件: HadoopOutputFormatTest.java
@Override
public boolean needsTaskCommit(TaskAttemptContext taskAttemptContext) throws IOException {
	return false;
}
 
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
}
 
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext) throws IOException {
  return false;
}
 
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
}
 
@Override
public void setupTask(TaskAttemptContext taskContext) throws IOException {
}
 
@Override
public boolean needsTaskCommit(TaskAttemptContext taskContext) throws IOException {
  return false;
}
 
@Override
public void commitTask(TaskAttemptContext taskContext) throws IOException {
}
 
源代码25 项目: incubator-tez   文件: MRTask.java
public org.apache.hadoop.mapreduce.TaskAttemptContext getTaskAttemptContext() {
  return taskAttemptContext;
}
 
源代码26 项目: tez   文件: MRTask.java
public org.apache.hadoop.mapreduce.TaskAttemptContext getTaskAttemptContext() {
  return taskAttemptContext;
}
 
源代码27 项目: Flink-CEPplus   文件: HadoopOutputFormatTest.java
@Override
public void setupTask(TaskAttemptContext taskAttemptContext) throws IOException {

}
 
源代码28 项目: Flink-CEPplus   文件: HadoopOutputFormatTest.java
@Override
public void commitTask(TaskAttemptContext taskAttemptContext) throws IOException {

}
 
源代码29 项目: Flink-CEPplus   文件: HadoopOutputFormatTest.java
@Override
public void abortTask(TaskAttemptContext taskAttemptContext) throws IOException {

}
 
源代码30 项目: flink   文件: HadoopOutputFormatTest.java
@Override
public void setupTask(TaskAttemptContext taskAttemptContext) throws IOException {

}
 
 类所在包
 类方法
 同包方法