1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.giraph.io.internal; |
20 | |
|
21 | |
import java.io.IOException; |
22 | |
|
23 | |
import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration; |
24 | |
import org.apache.giraph.graph.Vertex; |
25 | |
import org.apache.giraph.io.VertexReader; |
26 | |
import org.apache.giraph.job.HadoopUtils; |
27 | |
import org.apache.giraph.worker.WorkerGlobalCommUsage; |
28 | |
import org.apache.hadoop.io.Writable; |
29 | |
import org.apache.hadoop.io.WritableComparable; |
30 | |
import org.apache.hadoop.mapreduce.InputSplit; |
31 | |
import org.apache.hadoop.mapreduce.TaskAttemptContext; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
public class WrappedVertexReader<I extends WritableComparable, |
45 | |
V extends Writable, E extends Writable> extends VertexReader<I, V, E> { |
46 | |
|
47 | |
private final VertexReader<I, V, E> baseVertexReader; |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
public WrappedVertexReader(VertexReader<I, V, E> baseVertexReader, |
56 | 0 | ImmutableClassesGiraphConfiguration<I, V, E> conf) { |
57 | 0 | this.baseVertexReader = baseVertexReader; |
58 | 0 | super.setConf(conf); |
59 | 0 | baseVertexReader.setConf(conf); |
60 | 0 | } |
61 | |
|
62 | |
@Override |
63 | |
public void setConf( |
64 | |
ImmutableClassesGiraphConfiguration<I, V, E> conf) { |
65 | |
|
66 | 0 | } |
67 | |
|
68 | |
@Override |
69 | |
public void initialize(InputSplit inputSplit, |
70 | |
TaskAttemptContext context) throws IOException, InterruptedException { |
71 | 0 | baseVertexReader.initialize(inputSplit, |
72 | 0 | HadoopUtils.makeTaskAttemptContext(getConf(), context)); |
73 | 0 | } |
74 | |
|
75 | |
@Override |
76 | |
public void setWorkerGlobalCommUsage(WorkerGlobalCommUsage usage) { |
77 | 0 | super.setWorkerGlobalCommUsage(usage); |
78 | |
|
79 | 0 | baseVertexReader.setWorkerGlobalCommUsage(usage); |
80 | 0 | } |
81 | |
|
82 | |
@Override |
83 | |
public boolean nextVertex() throws IOException, InterruptedException { |
84 | 0 | return baseVertexReader.nextVertex(); |
85 | |
} |
86 | |
|
87 | |
@Override |
88 | |
public Vertex<I, V, E> getCurrentVertex() throws IOException, |
89 | |
InterruptedException { |
90 | 0 | return baseVertexReader.getCurrentVertex(); |
91 | |
} |
92 | |
|
93 | |
@Override |
94 | |
public void close() throws IOException { |
95 | 0 | baseVertexReader.close(); |
96 | 0 | } |
97 | |
|
98 | |
@Override |
99 | |
public float getProgress() throws IOException, InterruptedException { |
100 | 0 | return baseVertexReader.getProgress(); |
101 | |
} |
102 | |
} |