Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
GeneratedVertexInputFormat |
|
| 2.0;2 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
16 | * limitations under the License. | |
17 | */ | |
18 | ||
19 | package org.apache.giraph.examples; | |
20 | ||
21 | import org.apache.giraph.bsp.BspInputSplit; | |
22 | import org.apache.giraph.graph.VertexInputFormat; | |
23 | import org.apache.hadoop.io.Writable; | |
24 | import org.apache.hadoop.io.WritableComparable; | |
25 | import org.apache.hadoop.mapreduce.InputSplit; | |
26 | import org.apache.hadoop.mapreduce.JobContext; | |
27 | ||
28 | import java.io.IOException; | |
29 | import java.util.ArrayList; | |
30 | import java.util.List; | |
31 | ||
32 | /** | |
33 | * This VertexInputFormat is meant for testing/debugging. It simply generates | |
34 | * some vertex data that can be consumed by test applications. | |
35 | * | |
36 | * @param <I> Vertex id | |
37 | * @param <V> Vertex data | |
38 | * @param <E> Edge data | |
39 | * @param <M> Message data | |
40 | */ | |
41 | @SuppressWarnings("rawtypes") | |
42 | 0 | public abstract class GeneratedVertexInputFormat< |
43 | I extends WritableComparable, V extends Writable, E extends Writable, | |
44 | M extends Writable> extends VertexInputFormat<I, V, E, M> { | |
45 | @Override | |
46 | public List<InputSplit> getSplits(JobContext context, int numWorkers) | |
47 | throws IOException, InterruptedException { | |
48 | // This is meaningless, the VertexReader will generate all the test | |
49 | // data. | |
50 | 0 | List<InputSplit> inputSplitList = new ArrayList<InputSplit>(); |
51 | 0 | for (int i = 0; i < numWorkers; ++i) { |
52 | 0 | inputSplitList.add(new BspInputSplit(i, numWorkers)); |
53 | } | |
54 | 0 | return inputSplitList; |
55 | } | |
56 | } |