Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
VertexOutputFormat |
|
| 1.0;1 |
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.graph; | |
20 | ||
21 | import java.io.IOException; | |
22 | ||
23 | import org.apache.hadoop.mapreduce.JobContext; | |
24 | import org.apache.hadoop.mapreduce.OutputCommitter; | |
25 | ||
26 | import org.apache.hadoop.io.Writable; | |
27 | import org.apache.hadoop.io.WritableComparable; | |
28 | import org.apache.hadoop.mapreduce.TaskAttemptContext; | |
29 | ||
30 | /** | |
31 | * Implement to output the graph after the computation. It is modeled | |
32 | * directly after the Hadoop OutputFormat. | |
33 | * | |
34 | * @param <I> Vertex index value | |
35 | * @param <V> Vertex value | |
36 | * @param <E> Edge value | |
37 | */ | |
38 | @SuppressWarnings("rawtypes") | |
39 | 51 | public abstract class VertexOutputFormat< |
40 | I extends WritableComparable, V extends Writable, E extends Writable> { | |
41 | /** | |
42 | * Create a vertex writer for a given split. The framework will call | |
43 | * {@link VertexReader#initialize(InputSplit, TaskAttemptContext)} before | |
44 | * the split is used. | |
45 | * | |
46 | * @param context the information about the task | |
47 | * @return a new vertex writer | |
48 | * @throws IOException | |
49 | * @throws InterruptedException | |
50 | */ | |
51 | public abstract VertexWriter<I, V, E> createVertexWriter( | |
52 | TaskAttemptContext context) throws IOException, InterruptedException; | |
53 | ||
54 | /** | |
55 | * Check for validity of the output-specification for the job. | |
56 | * (Copied from Hadoop OutputFormat) | |
57 | * | |
58 | * <p>This is to validate the output specification for the job when it is | |
59 | * a job is submitted. Typically checks that it does not already exist, | |
60 | * throwing an exception when it already exists, so that output is not | |
61 | * overwritten.</p> | |
62 | * | |
63 | * @param context information about the job | |
64 | * @throws IOException when output should not be attempted | |
65 | */ | |
66 | public abstract void checkOutputSpecs(JobContext context) | |
67 | throws IOException, InterruptedException; | |
68 | ||
69 | /** | |
70 | * Get the output committer for this output format. This is responsible | |
71 | * for ensuring the output is committed correctly. | |
72 | * (Copied from Hadoop OutputFormat) | |
73 | * | |
74 | * @param context the task context | |
75 | * @return an output committer | |
76 | * @throws IOException | |
77 | * @throws InterruptedException | |
78 | */ | |
79 | public abstract OutputCommitter getOutputCommitter( | |
80 | TaskAttemptContext context) throws IOException, InterruptedException; | |
81 | } |