本文整理汇总了Java中org.apache.hadoop.mapreduce.lib.map.WrappedMapper.getMapContext方法的典型用法代码示例。如果您正苦于以下问题:Java WrappedMapper.getMapContext方法的具体用法?Java WrappedMapper.getMapContext怎么用?Java WrappedMapper.getMapContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapreduce.lib.map.WrappedMapper
的用法示例。
在下文中一共展示了WrappedMapper.getMapContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildProxyMapperContext
import org.apache.hadoop.mapreduce.lib.map.WrappedMapper; //导入方法依赖的package包/类
/**
* Utility to generate dummy Mapper#Context for use in Giraph internals.
* This is the "key hack" to inject MapReduce-related data structures
* containing YARN cluster metadata (and our GiraphConf from the AppMaster)
* into our Giraph BSP task code.
* @param tid the TaskAttemptID to construct this Mapper#Context from.
* @return sort of a Mapper#Context if you squint just right.
*/
private Context buildProxyMapperContext(final TaskAttemptID tid) {
MapContext mc = new MapContextImpl<Object, Object, Object, Object>(
conf, // our Configuration, populated back at the GiraphYarnClient.
tid, // our TaskAttemptId, generated w/YARN app, container, attempt IDs
null, // RecordReader here will never be used by Giraph
null, // RecordWriter here will never be used by Giraph
null, // OutputCommitter here will never be used by Giraph
new TaskAttemptContextImpl.DummyReporter() { // goes in task logs for now
@Override
public void setStatus(String msg) {
LOG.info("[STATUS: task-" + bspTaskId + "] " + msg);
}
},
null); // Input split setting here will never be used by Giraph
// now, we wrap our MapContext ref so we can produce a Mapper#Context
WrappedMapper<Object, Object, Object, Object> wrappedMapper
= new WrappedMapper<Object, Object, Object, Object>();
return wrappedMapper.getMapContext(mc);
}
示例2: StubContext
import org.apache.hadoop.mapreduce.lib.map.WrappedMapper; //导入方法依赖的package包/类
public StubContext(Configuration conf, RecordReader<Text, CopyListingFileStatus> reader, int taskId)
throws IOException, InterruptedException {
WrappedMapper<Text, CopyListingFileStatus, Text, Text> wrappedMapper = new WrappedMapper<>();
MapContextImpl<Text, CopyListingFileStatus, Text, Text> contextImpl = new MapContextImpl<>(conf,
getTaskAttemptID(taskId), reader, writer, null, reporter, null);
this.reader = reader;
mapperContext = wrappedMapper.getMapContext(contextImpl);
}
示例3: StubContext
import org.apache.hadoop.mapreduce.lib.map.WrappedMapper; //导入方法依赖的package包/类
public StubContext(Configuration conf,
RecordReader<Text, CopyListingFileStatus> reader, int taskId)
throws IOException, InterruptedException {
WrappedMapper<Text, CopyListingFileStatus, Text, Text> wrappedMapper
= new WrappedMapper<Text, CopyListingFileStatus, Text, Text>();
MapContextImpl<Text, CopyListingFileStatus, Text, Text> contextImpl
= new MapContextImpl<Text, CopyListingFileStatus, Text, Text>(conf,
getTaskAttemptID(taskId), reader, writer,
null, reporter, null);
this.reader = reader;
this.mapperContext = wrappedMapper.getMapContext(contextImpl);
}
示例4: StubContext
import org.apache.hadoop.mapreduce.lib.map.WrappedMapper; //导入方法依赖的package包/类
public StubContext(Configuration conf, RecordReader<Text, FileStatus> reader,
int taskId) throws IOException, InterruptedException {
WrappedMapper<Text, FileStatus, Text, Text> wrappedMapper
= new WrappedMapper<Text, FileStatus, Text, Text>();
MapContextImpl<Text, FileStatus, Text, Text> contextImpl
= new MapContextImpl<Text, FileStatus, Text, Text>(conf,
getTaskAttemptID(taskId), reader, writer,
null, reporter, null);
this.reader = reader;
this.mapperContext = wrappedMapper.getMapContext(contextImpl);
}