|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||
java.lang.Objectorg.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
ml.shifu.guagua.mapreduce.GuaguaMRRecordReader
public class GuaguaMRRecordReader
GuaguaMRRecordReader is used as a mock for mapreduce reader interface, not real reading data.
To update progress, currentIteration and totalIterations should be set. currentIteration
only can be set in GuaguaMapper.run.
Why set currentIteration to static? The reason is that currentIteration for task cannot be transferred to
#GuaguaRecordReader because of no API from MapperContext. So static field here is used to update current
iteration.
If currentIteration is not set in each iteration. It can only start from 0. This progress update doesn't
work well for task fail-over(TODO).
| 构造方法摘要 | |
|---|---|
GuaguaMRRecordReader()
Default constructor, totalIterations is set to default 0. |
|
GuaguaMRRecordReader(int totalIterations)
Constructor with totalIterations setting. |
|
| 方法摘要 | |
|---|---|
void |
close()
|
org.apache.hadoop.io.LongWritable |
getCurrentKey()
This is a mock to hide Hadoop raw map iteration on map input key. |
org.apache.hadoop.io.Text |
getCurrentValue()
This is a mock to hide Hadoop raw map iteration on map input value. |
float |
getProgress()
Each iteration context.nextKeyValue should be called, and currentIteration is updated, so the progress is
updated. |
void |
initialize(org.apache.hadoop.mapreduce.InputSplit inputSplit,
org.apache.hadoop.mapreduce.TaskAttemptContext context)
|
boolean |
nextKeyValue()
Update iteration number. |
static void |
setCurrentIteration(int currentIteration)
Should only be called in GuaguaMapper Progress callback. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public GuaguaMRRecordReader()
totalIterations is set to default 0.
public GuaguaMRRecordReader(int totalIterations)
totalIterations setting.
totalIterations - total iterations for such guagua job.| 方法详细信息 |
|---|
public void close()
throws IOException
Closeable 中的 closeorg.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> 中的 closeIOException
public float getProgress()
throws IOException
context.nextKeyValue should be called, and currentIteration is updated, so the progress is
updated.
org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> 中的 getProgressIOException
public org.apache.hadoop.io.LongWritable getCurrentKey()
throws IOException,
InterruptedException
org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> 中的 getCurrentKeyIOException
InterruptedException
public org.apache.hadoop.io.Text getCurrentValue()
throws IOException,
InterruptedException
org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> 中的 getCurrentValueIOException
InterruptedException
public void initialize(org.apache.hadoop.mapreduce.InputSplit inputSplit,
org.apache.hadoop.mapreduce.TaskAttemptContext context)
throws IOException,
InterruptedException
org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> 中的 initializeIOException
InterruptedException
public boolean nextKeyValue()
throws IOException,
InterruptedException
org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> 中的 nextKeyValueIOException
InterruptedExceptionpublic static void setCurrentIteration(int currentIteration)
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||