You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by er...@apache.org on 2013/02/17 18:36:41 UTC
git commit: GIRAPH-503: Refactor platform-independent CLI argument
parsing in GiraphRunner into a separate class (ereisman)
Updated Branches:
refs/heads/trunk 028b0c92f -> 2bdc23892
GIRAPH-503: Refactor platform-independent CLI argument parsing in GiraphRunner into a separate class (ereisman)
Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/2bdc2389
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/2bdc2389
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/2bdc2389
Branch: refs/heads/trunk
Commit: 2bdc238928b93e8b96bbcbb0794a3e76254a2a33
Parents: 028b0c9
Author: Eli Reisman <er...@apache.org>
Authored: Sun Feb 17 09:32:16 2013 -0800
Committer: Eli Reisman <er...@apache.org>
Committed: Sun Feb 17 09:32:16 2013 -0800
----------------------------------------------------------------------
CHANGELOG | 2 +
.../main/java/org/apache/giraph/GiraphRunner.java | 236 ++---------
.../org/apache/giraph/conf/GiraphConstants.java | 3 +
.../giraph/io/formats/GiraphFileInputFormat.java | 13 +-
.../giraph/job/GiraphConfigurationValidator.java | 330 +++++++++++++++
.../main/java/org/apache/giraph/job/GiraphJob.java | 53 +---
.../org/apache/giraph/job/GiraphTypeValidator.java | 282 ------------
.../apache/giraph/utils/ConfigurationUtils.java | 325 ++++++++++++++
.../apache/giraph/utils/InternalVertexRunner.java | 4 +-
.../org/apache/giraph/io/TestJsonBase64Format.java | 3 +-
.../org/apache/giraph/vertex/TestVertexTypes.java | 63 ++--
11 files changed, 738 insertions(+), 576 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 776ace2..6cc74ea 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
Giraph Change Log
Release 0.2.0 - unreleased
+ GIRAPH-503: Refactor platform-independent CLI argument parsing in GiraphRunner into a separate class (ereisman)
+
GIRAPH-519: EdgeFactory (nitay)
GIRAPH-515: More efficient and flexible edge-based input (apresta)
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/GiraphRunner.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/GiraphRunner.java b/giraph-core/src/main/java/org/apache/giraph/GiraphRunner.java
index 1516fff..5bd5686 100644
--- a/giraph-core/src/main/java/org/apache/giraph/GiraphRunner.java
+++ b/giraph-core/src/main/java/org/apache/giraph/GiraphRunner.java
@@ -17,42 +17,25 @@
*/
package org.apache.giraph;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Options;
-import org.apache.giraph.aggregators.AggregatorWriter;
-import org.apache.giraph.combiner.Combiner;
+import org.apache.giraph.utils.ConfigurationUtils;
import org.apache.giraph.conf.GiraphConfiguration;
import org.apache.giraph.job.GiraphJob;
-import org.apache.giraph.job.GiraphTypeValidator;
-import org.apache.giraph.io.EdgeInputFormat;
-import org.apache.giraph.io.VertexInputFormat;
-import org.apache.giraph.io.VertexOutputFormat;
-import org.apache.giraph.io.formats.GiraphFileInputFormat;
-import org.apache.giraph.master.MasterCompute;
-import org.apache.giraph.utils.AnnotationUtils;
-import org.apache.giraph.vertex.Vertex;
-import org.apache.giraph.worker.WorkerContext;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.zookeeper.ZooKeeper;
-
import java.net.URI;
-import java.util.List;
/**
* Helper class to run Giraph applications by specifying the actual class name
* to use (i.e. vertex, vertex input/output format, combiner, etc.).
+ *
+ * This is the default entry point for Giraph jobs running on any Hadoop
+ * cluster, MRv1 or v2, including Hadoop-specific configuration and setup.
*/
public class GiraphRunner implements Tool {
static {
@@ -64,37 +47,6 @@ public class GiraphRunner implements Tool {
/** Writable conf */
private Configuration conf;
- /**
- * Get the options available.
- *
- * @return Options available.
- */
- private static Options getOptions() {
- Options options = new Options();
- options.addOption("h", "help", false, "Help");
- options.addOption("la", "listAlgorithms", false, "List supported " +
- "algorithms");
- options.addOption("q", "quiet", false, "Quiet output");
- options.addOption("w", "workers", true, "Number of workers");
- options.addOption("vif", "vertexInputFormat", true, "Vertex input format");
- options.addOption("eif", "edgeInputFormat", true, "Edge input format");
- options.addOption("of", "outputFormat", true, "Vertex output format");
- options.addOption("vip", "vertexInputPath", true, "Vertex input path");
- options.addOption("eip", "edgeInputPath", true, "Edge input path");
- options.addOption("op", "outputPath", true, "Vertex output path");
- options.addOption("c", "combiner", true, "Combiner class");
- options.addOption("wc", "workerContext", true, "WorkerContext class");
- options.addOption("aw", "aggregatorWriter", true, "AggregatorWriter class");
- options.addOption("mc", "masterCompute", true, "MasterCompute class");
- options.addOption("cf", "cacheFile", true, "Files for distributed cache");
- options.addOption("ca", "customArguments", true, "provide custom" +
- " arguments for the job configuration in the form:" +
- " -ca <param1>=<value1>,<param2>=<value2> -ca <param3>=<value3> etc." +
- " It can appear multiple times, and the last one has effect" +
- " for the same param.");
- return options;
- }
-
@Override
public Configuration getConf() {
return conf;
@@ -105,182 +57,48 @@ public class GiraphRunner implements Tool {
this.conf = conf;
}
+ @Override
/**
- * Prints description of algorithms annotated with {@link Algorithm}
+ * Drives a job run configured for "Giraph on Hadoop MR cluster"
+ * @param args the command line arguments
+ * @return job run exit code
*/
- private void printSupportedAlgorithms() {
- Logger.getLogger(ZooKeeper.class).setLevel(Level.OFF);
-
- List<Class<?>> classes = AnnotationUtils.getAnnotatedClasses(
- Algorithm.class, "org.apache.giraph");
- System.out.print(" Supported algorithms:\n");
- for (Class<?> clazz : classes) {
- if (Vertex.class.isAssignableFrom(clazz)) {
- Algorithm algorithm = clazz.getAnnotation(Algorithm.class);
- StringBuilder sb = new StringBuilder();
- sb.append(algorithm.name()).append(" - ").append(clazz.getName())
- .append("\n");
- if (!algorithm.description().equals("")) {
- sb.append(" ").append(algorithm.description()).append("\n");
- }
- System.out.print(sb.toString());
- }
- }
- }
-
- @Override
public int run(String[] args) throws Exception {
- Options options = getOptions();
-
- CommandLineParser parser = new BasicParser();
- CommandLine cmd = parser.parse(options, args);
-
- if (args.length == 0 || cmd.hasOption("h")) {
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp(getClass().getName(), options, true);
- return 0;
+ GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
+ CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);
+ if (null == cmd) {
+ return 0; // user requested help/info printout, don't run a job.
}
- if (cmd.hasOption("la")) {
- printSupportedAlgorithms();
- return 0;
- }
+ final String vertexClassName = args[0];
+ GiraphJob job = new GiraphJob(giraphConf, "Giraph: " + vertexClassName);
+ prepareHadoopMRJob(job, cmd);
- String vertexClassName = args[0];
if (LOG.isDebugEnabled()) {
LOG.debug("Attempting to run Vertex: " + vertexClassName);
}
+ boolean verbose = !cmd.hasOption('q');
+ return job.run(verbose) ? 0 : -1;
+ }
- // Verify all the required options have been provided
- if (!cmd.hasOption("w")) {
- if (LOG.isInfoEnabled()) {
- LOG.info("Need to choose the number of workers (-w)");
- }
- return -1;
- }
- if (!cmd.hasOption("vif") && !cmd.hasOption("eif")) {
- if (LOG.isInfoEnabled()) {
- LOG.info("Need to set an input format (-vif or -eif)");
- }
- return -1;
- }
-
- int workers = Integer.parseInt(cmd.getOptionValue('w'));
-
- GiraphConfiguration giraphConfiguration = new GiraphConfiguration(
- getConf());
-
- giraphConfiguration.setVertexClass(
- (Class<? extends Vertex>) Class.forName(vertexClassName));
-
- GiraphJob job = new GiraphJob(
- giraphConfiguration, "Giraph: " + vertexClassName);
-
- if (cmd.hasOption("vif")) {
- giraphConfiguration.setVertexInputFormatClass(
- (Class<? extends VertexInputFormat>)
- Class.forName(cmd.getOptionValue("vif")));
- if (cmd.hasOption("vip")) {
- GiraphFileInputFormat.addVertexInputPath(job.getInternalJob(),
- new Path(cmd.getOptionValue("vip")));
- } else {
- if (LOG.isInfoEnabled()) {
- LOG.info("No vertex input path specified. Ensure your " +
- "VertexInputFormat does not require one.");
- }
- }
- }
-
- if (cmd.hasOption("eif")) {
- giraphConfiguration.setEdgeInputFormatClass(
- (Class<? extends EdgeInputFormat>)
- Class.forName(cmd.getOptionValue("eif")));
- if (cmd.hasOption("eip")) {
- GiraphFileInputFormat.addEdgeInputPath(job.getInternalJob(),
- new Path(cmd.getOptionValue("eip")));
- } else {
- if (LOG.isInfoEnabled()) {
- LOG.info("No edge input path specified. Ensure your " +
- "VertexInputFormat does not require one.");
- }
- }
- }
-
+ /**
+ * Populate internal Hadoop Job (and Giraph IO Formats) with Hadoop-specific
+ * configuration/setup metadata, propagating exceptions to calling code.
+ * @param job the GiraphJob object to help populate Giraph IO Format data.
+ * @param cmd the CommandLine for parsing Hadoop MR-specific args.
+ */
+ private void prepareHadoopMRJob(final GiraphJob job, final CommandLine cmd)
+ throws Exception {
if (cmd.hasOption("of")) {
- giraphConfiguration.setVertexOutputFormatClass(
- (Class<? extends VertexOutputFormat>)
- Class.forName(cmd.getOptionValue("of")));
if (cmd.hasOption("op")) {
FileOutputFormat.setOutputPath(job.getInternalJob(),
- new Path(cmd.getOptionValue("op")));
- } else {
- if (LOG.isInfoEnabled()) {
- LOG.info("No output path specified. Ensure your VertexOutputFormat " +
- "does not require one.");
- }
+ new Path(cmd.getOptionValue("op")));
}
}
-
- if (cmd.hasOption("c")) {
- giraphConfiguration.setVertexCombinerClass(
- (Class<? extends Combiner>)
- Class.forName(cmd.getOptionValue("c")));
- }
-
- if (cmd.hasOption("wc")) {
- giraphConfiguration.setWorkerContextClass(
- (Class<? extends WorkerContext>)
- Class.forName(cmd.getOptionValue("wc")));
- }
-
- if (cmd.hasOption("mc")) {
- giraphConfiguration.setMasterComputeClass(
- (Class<? extends MasterCompute>)
- Class.forName(cmd.getOptionValue("mc")));
- }
-
- if (cmd.hasOption("aw")) {
- giraphConfiguration.setAggregatorWriterClass(
- (Class<? extends AggregatorWriter>)
- Class.forName(cmd.getOptionValue("aw")));
- }
-
if (cmd.hasOption("cf")) {
DistributedCache.addCacheFile(new URI(cmd.getOptionValue("cf")),
job.getConfiguration());
}
-
- if (cmd.hasOption("ca")) {
- Configuration jobConf = job.getConfiguration();
- for (String caOptionValue : cmd.getOptionValues("ca")) {
- for (String paramValue :
- Splitter.on(',').split(caOptionValue)) {
- String[] parts = Iterables.toArray(Splitter.on('=').split(paramValue),
- String.class);
- if (parts.length != 2) {
- throw new IllegalArgumentException("Unable to parse custom " +
- " argument: " + paramValue);
- }
- if (LOG.isInfoEnabled()) {
- LOG.info("Setting custom argument [" + parts[0] + "] to [" +
- parts[1] + "]");
- }
- jobConf.set(parts[0], parts[1]);
- }
- }
- }
-
- // validate generic parameters chosen are correct or
- // throw IllegalArgumentException, halting execution.
- @SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(job.getConfiguration());
- validator.validateClassTypes();
-
- giraphConfiguration.setWorkerConfiguration(workers, workers, 100.0f);
-
- boolean verbose = !cmd.hasOption('q');
- return job.run(verbose) ? 0 : -1;
}
/**
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java
index 20d6df7..da75e5a 100644
--- a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java
+++ b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java
@@ -57,6 +57,9 @@ public interface GiraphConstants {
/** VertexOutputFormat class */
String VERTEX_OUTPUT_FORMAT_CLASS = "giraph.vertexOutputFormatClass";
+ /** Output Format Path (for Giraph-on-YARN) */
+ String GIRAPH_OUTPUT_DIR = "giraph.output.dir";
+
/** Vertex index class */
String VERTEX_ID_CLASS = "giraph.vertexIdClass";
/** Vertex value class */
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/io/formats/GiraphFileInputFormat.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/io/formats/GiraphFileInputFormat.java b/giraph-core/src/main/java/org/apache/giraph/io/formats/GiraphFileInputFormat.java
index 9c160fe..fc4baa4 100644
--- a/giraph-core/src/main/java/org/apache/giraph/io/formats/GiraphFileInputFormat.java
+++ b/giraph-core/src/main/java/org/apache/giraph/io/formats/GiraphFileInputFormat.java
@@ -25,7 +25,6 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
@@ -81,12 +80,12 @@ public abstract class GiraphFileInputFormat<K, V>
/**
* Add a {@link org.apache.hadoop.fs.Path} to the list of vertex inputs.
*
- * @param job The {@link org.apache.hadoop.mapreduce.Job} to modify
+ * @param conf the Configuration to store the input paths
* @param path {@link org.apache.hadoop.fs.Path} to be added to the list of
* vertex inputs
*/
- public static void addVertexInputPath(Job job, Path path) throws IOException {
- Configuration conf = job.getConfiguration();
+ public static void addVertexInputPath(Configuration conf,
+ Path path) throws IOException {
path = path.getFileSystem(conf).makeQualified(path);
String dirStr = StringUtils.escapeString(path.toString());
String dirs = conf.get(VERTEX_INPUT_DIR);
@@ -96,12 +95,12 @@ public abstract class GiraphFileInputFormat<K, V>
/**
* Add a {@link org.apache.hadoop.fs.Path} to the list of edge inputs.
*
- * @param job The {@link org.apache.hadoop.mapreduce.Job} to modify
+ * @param conf the Configuration to store the input paths
* @param path {@link org.apache.hadoop.fs.Path} to be added to the list of
* edge inputs
*/
- public static void addEdgeInputPath(Job job, Path path) throws IOException {
- Configuration conf = job.getConfiguration();
+ public static void addEdgeInputPath(Configuration conf,
+ Path path) throws IOException {
path = path.getFileSystem(conf).makeQualified(path);
String dirStr = StringUtils.escapeString(path.toString());
String dirs = conf.get(EDGE_INPUT_DIR);
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java b/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
new file mode 100644
index 0000000..16b0d48
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
@@ -0,0 +1,330 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.giraph.job;
+
+import org.apache.giraph.bsp.BspUtils;
+import org.apache.giraph.combiner.Combiner;
+import org.apache.giraph.conf.GiraphConstants;
+import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.giraph.graph.DefaultVertexResolver;
+import org.apache.giraph.graph.VertexResolver;
+import org.apache.giraph.io.EdgeInputFormat;
+import org.apache.giraph.io.VertexInputFormat;
+import org.apache.giraph.io.VertexOutputFormat;
+import org.apache.giraph.utils.ReflectionUtils;
+import org.apache.giraph.vertex.MutableVertex;
+import org.apache.giraph.vertex.Vertex;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+import org.apache.log4j.Logger;
+
+import java.lang.reflect.Type;
+import java.util.List;
+
+/**
+ * GiraphConfigurationValidator attempts to verify the consistency of
+ * user-chosen InputFormat, OutputFormat, and Vertex generic type
+ * parameters as well as the general Configuration settings
+ * before the job run actually begins.
+ *
+ * @param <I> the Vertex ID type
+ * @param <V> the Vertex Value type
+ * @param <E> the Edge Value type
+ * @param <M> the Message type
+ */
+public class GiraphConfigurationValidator<I extends WritableComparable,
+ V extends Writable, E extends Writable, M extends Writable> {
+ /**
+ * Class logger object.
+ */
+ private static Logger LOG =
+ Logger.getLogger(GiraphConfigurationValidator.class);
+
+ /** I param vertex index in classList */
+ private static final int ID_PARAM_INDEX = 0;
+ /** V param vertex index in classList */
+ private static final int VALUE_PARAM_INDEX = 1;
+ /** E param vertex index in classList */
+ private static final int EDGE_PARAM_INDEX = 2;
+ /** M param vertex index in classList */
+ private static final int MSG_PARAM_INDEX = 3;
+ /** M param vertex combiner index in classList */
+ private static final int MSG_COMBINER_PARAM_INDEX = 1;
+ /** E param edge input format index in classList */
+ private static final int EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX = 1;
+
+ /** Vertex Index Type */
+ private Type vertexIndexType;
+ /** Vertex Index Type */
+ private Type vertexValueType;
+ /** Vertex Index Type */
+ private Type edgeValueType;
+ /** Vertex Index Type */
+ private Type messageValueType;
+
+ /**
+ * The Configuration object for use in the validation test.
+ */
+ private ImmutableClassesGiraphConfiguration conf;
+
+ /**
+ * Constructor to execute the validation test, throws
+ * unchecked exception to end job run on failure.
+ *
+ * @param conf the Configuration for this run.
+ */
+ public GiraphConfigurationValidator(Configuration conf) {
+ this.conf = new ImmutableClassesGiraphConfiguration(conf);
+ }
+
+ /**
+ * Make sure that all registered classes have matching types. This
+ * is a little tricky due to type erasure, cannot simply get them from
+ * the class type arguments. Also, set the vertex index, vertex value,
+ * edge value and message value classes.
+ */
+ public void validateConfiguration() {
+ checkConfiguration();
+ Class<? extends Vertex<I, V, E, M>> vertexClass =
+ BspUtils.<I, V, E, M>getVertexClass(conf);
+ List<Class<?>> classList = ReflectionUtils.getTypeArguments(
+ Vertex.class, vertexClass);
+ vertexIndexType = classList.get(ID_PARAM_INDEX);
+ vertexValueType = classList.get(VALUE_PARAM_INDEX);
+ edgeValueType = classList.get(EDGE_PARAM_INDEX);
+ messageValueType = classList.get(MSG_PARAM_INDEX);
+ verifyVertexInputFormatGenericTypes();
+ verifyEdgeInputFormatGenericTypes();
+ verifyVertexOutputFormatGenericTypes();
+ verifyVertexResolverGenericTypes();
+ verifyVertexCombinerGenericTypes();
+ }
+
+ /**
+ * Make sure the configuration is set properly by the user prior to
+ * submitting the job.
+ */
+ private void checkConfiguration() {
+ if (conf.getMaxWorkers() < 0) {
+ throw new RuntimeException("checkConfiguration: No valid " +
+ GiraphConstants.MAX_WORKERS);
+ }
+ if (conf.getMinPercentResponded() <= 0.0f ||
+ conf.getMinPercentResponded() > 100.0f) {
+ throw new IllegalArgumentException(
+ "checkConfiguration: Invalid " + conf.getMinPercentResponded() +
+ " for " + GiraphConstants.MIN_PERCENT_RESPONDED);
+ }
+ if (conf.getMinWorkers() < 0) {
+ throw new IllegalArgumentException("checkConfiguration: No valid " +
+ GiraphConstants.MIN_WORKERS);
+ }
+ if (conf.getVertexClass() == null) {
+ throw new IllegalArgumentException("checkConfiguration: Null" +
+ GiraphConstants.VERTEX_CLASS);
+ }
+ if (conf.getVertexInputFormatClass() == null &&
+ conf.getEdgeInputFormatClass() == null) {
+ throw new IllegalArgumentException("checkConfiguration: One of " +
+ GiraphConstants.VERTEX_INPUT_FORMAT_CLASS + " and " +
+ GiraphConstants.EDGE_INPUT_FORMAT_CLASS + " must be non-null");
+ }
+ if (conf.getEdgeInputFormatClass() != null &&
+ !(MutableVertex.class.isAssignableFrom(conf.getVertexClass()))) {
+ throw new IllegalArgumentException("checkConfiguration: EdgeInputFormat" +
+ " only works with mutable vertices");
+ }
+ if (conf.getVertexResolverClass() == null) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("checkConfiguration: No class found for " +
+ GiraphConstants.VERTEX_RESOLVER_CLASS + ", defaulting to " +
+ DefaultVertexResolver.class.getCanonicalName());
+ }
+ }
+ }
+
+ /** Verify matching generic types in VertexInputFormat. */
+ private void verifyVertexInputFormatGenericTypes() {
+ Class<? extends VertexInputFormat<I, V, E, M>> vertexInputFormatClass =
+ BspUtils.<I, V, E, M>getVertexInputFormatClass(conf);
+ if (vertexInputFormatClass != null) {
+ List<Class<?>> classList =
+ ReflectionUtils.getTypeArguments(
+ VertexInputFormat.class, vertexInputFormatClass);
+ if (classList.get(ID_PARAM_INDEX) == null) {
+ LOG.warn("Input format vertex index type is not known");
+ } else if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex index types don't match, " +
+ "vertex - " + vertexIndexType +
+ ", vertex input format - " + classList.get(ID_PARAM_INDEX));
+ }
+ if (classList.get(VALUE_PARAM_INDEX) == null) {
+ LOG.warn("Input format vertex value type is not known");
+ } else if (!vertexValueType.equals(classList.get(VALUE_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex value types don't match, " +
+ "vertex - " + vertexValueType +
+ ", vertex input format - " + classList.get(VALUE_PARAM_INDEX));
+ }
+ if (classList.get(EDGE_PARAM_INDEX) == null) {
+ LOG.warn("Input format edge value type is not known");
+ } else if (!edgeValueType.equals(classList.get(EDGE_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Edge value types don't match, " +
+ "vertex - " + edgeValueType +
+ ", vertex input format - " + classList.get(EDGE_PARAM_INDEX));
+ }
+ }
+ }
+
+ /** Verify matching generic types in EdgeInputFormat. */
+ private void verifyEdgeInputFormatGenericTypes() {
+ Class<? extends EdgeInputFormat<I, E>> edgeInputFormatClass =
+ BspUtils.<I, E>getEdgeInputFormatClass(conf);
+ if (edgeInputFormatClass != null) {
+ List<Class<?>> classList =
+ ReflectionUtils.getTypeArguments(
+ EdgeInputFormat.class, edgeInputFormatClass);
+ if (classList.get(ID_PARAM_INDEX) == null) {
+ LOG.warn("Input format vertex index type is not known");
+ } else if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex index types don't match, " +
+ "vertex - " + vertexIndexType +
+ ", edge input format - " + classList.get(ID_PARAM_INDEX));
+ }
+ if (classList.get(EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX) == null) {
+ LOG.warn("Input format edge value type is not known");
+ } else if (!edgeValueType.equals(
+ classList.get(EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Edge value types don't match, " +
+ "vertex - " + edgeValueType +
+ ", edge input format - " +
+ classList.get(EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX));
+ }
+ }
+ }
+
+ /** If there is a combiner type, verify its generic params match the job. */
+ private void verifyVertexCombinerGenericTypes() {
+ Class<? extends Combiner<I, M>> vertexCombinerClass =
+ BspUtils.<I, M>getCombinerClass(conf);
+ if (vertexCombinerClass != null) {
+ List<Class<?>> classList =
+ ReflectionUtils.getTypeArguments(
+ Combiner.class, vertexCombinerClass);
+ if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex index types don't match, " +
+ "vertex - " + vertexIndexType +
+ ", vertex combiner - " + classList.get(ID_PARAM_INDEX));
+ }
+ if (!messageValueType.equals(classList.get(MSG_COMBINER_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Message value types don't match, " +
+ "vertex - " + messageValueType +
+ ", vertex combiner - " + classList.get(MSG_COMBINER_PARAM_INDEX));
+ }
+ }
+ }
+
+ /** Verify that the output format's generic params match the job. */
+ private void verifyVertexOutputFormatGenericTypes() {
+ Class<? extends VertexOutputFormat<I, V, E>>
+ vertexOutputFormatClass =
+ BspUtils.<I, V, E>getVertexOutputFormatClass(conf);
+ if (vertexOutputFormatClass != null) {
+ List<Class<?>> classList =
+ ReflectionUtils.getTypeArguments(
+ VertexOutputFormat.class, vertexOutputFormatClass);
+ if (classList.get(ID_PARAM_INDEX) == null) {
+ LOG.warn("Output format vertex index type is not known");
+ } else if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex index types don't match, " +
+ "vertex - " + vertexIndexType +
+ ", vertex output format - " + classList.get(ID_PARAM_INDEX));
+ }
+ if (classList.get(VALUE_PARAM_INDEX) == null) {
+ LOG.warn("Output format vertex value type is not known");
+ } else if (!vertexValueType.equals(classList.get(VALUE_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex value types don't match, " +
+ "vertex - " + vertexValueType +
+ ", vertex output format - " + classList.get(VALUE_PARAM_INDEX));
+ }
+ if (classList.get(EDGE_PARAM_INDEX) == null) {
+ LOG.warn("Output format edge value type is not known");
+ } else if (!edgeValueType.equals(classList.get(EDGE_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Edge value types don't match, " +
+ "vertex - " + edgeValueType +
+ ", vertex output format - " + classList.get(EDGE_PARAM_INDEX));
+ }
+ }
+ }
+
+ /** If there is a vertex resolver,
+ * validate the generic parameter types. */
+ private void verifyVertexResolverGenericTypes() {
+ Class<? extends VertexResolver<I, V, E, M>>
+ vrClass = BspUtils.<I, V, E, M>getVertexResolverClass(conf);
+ if (!DefaultVertexResolver.class.isAssignableFrom(vrClass)) {
+ return;
+ }
+ Class<? extends DefaultVertexResolver<I, V, E, M>>
+ dvrClass =
+ (Class<? extends DefaultVertexResolver<I, V, E, M>>) vrClass;
+ List<Class<?>> classList =
+ ReflectionUtils.getTypeArguments(
+ DefaultVertexResolver.class, dvrClass);
+ if (classList.get(ID_PARAM_INDEX) != null &&
+ !vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex index types don't match, " +
+ "vertex - " + vertexIndexType +
+ ", vertex resolver - " + classList.get(ID_PARAM_INDEX));
+ }
+ if (classList.get(VALUE_PARAM_INDEX) != null &&
+ !vertexValueType.equals(classList.get(VALUE_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Vertex value types don't match, " +
+ "vertex - " + vertexValueType +
+ ", vertex resolver - " + classList.get(VALUE_PARAM_INDEX));
+ }
+ if (classList.get(EDGE_PARAM_INDEX) != null &&
+ !edgeValueType.equals(classList.get(EDGE_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Edge value types don't match, " +
+ "vertex - " + edgeValueType +
+ ", vertex resolver - " + classList.get(EDGE_PARAM_INDEX));
+ }
+ if (classList.get(MSG_PARAM_INDEX) != null &&
+ !messageValueType.equals(classList.get(MSG_PARAM_INDEX))) {
+ throw new IllegalArgumentException(
+ "checkClassTypes: Message value types don't match, " +
+ "vertex - " + messageValueType +
+ ", vertex resolver - " + classList.get(MSG_PARAM_INDEX));
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java b/giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java
index 9f711da..da85d1c 100644
--- a/giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java
+++ b/giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java
@@ -23,9 +23,7 @@ import org.apache.giraph.bsp.BspOutputFormat;
import org.apache.giraph.conf.GiraphConfiguration;
import org.apache.giraph.conf.GiraphConstants;
import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
-import org.apache.giraph.graph.DefaultVertexResolver;
import org.apache.giraph.graph.GraphMapper;
-import org.apache.giraph.vertex.MutableVertex;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.Client;
import org.apache.hadoop.mapreduce.Job;
@@ -132,60 +130,16 @@ public class GiraphJob {
delegatedJob.jobInited = true;
return delegatedJob;
}
- /**
- * Make sure the configuration is set properly by the user prior to
- * submitting the job.
- *
- * @param conf Configuration to check
- */
- private void checkConfiguration(ImmutableClassesGiraphConfiguration conf) {
- if (conf.getMaxWorkers() < 0) {
- throw new RuntimeException("checkConfiguration: No valid " +
- GiraphConstants.MAX_WORKERS);
- }
- if (conf.getMinPercentResponded() <= 0.0f ||
- conf.getMinPercentResponded() > 100.0f) {
- throw new IllegalArgumentException(
- "checkConfiguration: Invalid " + conf.getMinPercentResponded() +
- " for " + GiraphConstants.MIN_PERCENT_RESPONDED);
- }
- if (conf.getMinWorkers() < 0) {
- throw new IllegalArgumentException("checkConfiguration: No valid " +
- GiraphConstants.MIN_WORKERS);
- }
- if (conf.getVertexClass() == null) {
- throw new IllegalArgumentException("checkConfiguration: Null" +
- GiraphConstants.VERTEX_CLASS);
- }
- if (conf.getVertexInputFormatClass() == null &&
- conf.getEdgeInputFormatClass() == null) {
- throw new IllegalArgumentException("checkConfiguration: One of " +
- GiraphConstants.VERTEX_INPUT_FORMAT_CLASS + " and " +
- GiraphConstants.EDGE_INPUT_FORMAT_CLASS + " must be non-null");
- }
- if (conf.getEdgeInputFormatClass() != null &&
- !(MutableVertex.class.isAssignableFrom(conf.getVertexClass()))) {
- throw new IllegalArgumentException("checkConfiguration: EdgeInputFormat" +
- " only works with mutable vertices");
- }
- if (conf.getVertexResolverClass() == null) {
- if (LOG.isInfoEnabled()) {
- LOG.info("checkConfiguration: No class found for " +
- GiraphConstants.VERTEX_RESOLVER_CLASS + ", defaulting to " +
- DefaultVertexResolver.class.getCanonicalName());
- }
- }
- }
-
/**
* Check if the configuration is local. If it is local, do additional
- * checks due to the restrictions of LocalJobRunner.
+ * checks due to the restrictions of LocalJobRunner. This checking is
+ * performed here because the local job runner is MRv1-configured.
*
* @param conf Configuration
*/
private static void checkLocalJobRunnerConfiguration(
- GiraphConfiguration conf) {
+ ImmutableClassesGiraphConfiguration conf) {
String jobTracker = conf.get("mapred.job.tracker", null);
if (!jobTracker.equals("local")) {
// Nothing to check
@@ -268,7 +222,6 @@ public class GiraphJob {
// Set the job properties, check them, and submit the job
ImmutableClassesGiraphConfiguration conf =
new ImmutableClassesGiraphConfiguration(giraphConfiguration);
- checkConfiguration(conf);
checkLocalJobRunnerConfiguration(conf);
Job submittedJob = new Job(conf, jobName);
if (submittedJob.getJar() == null) {
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/job/GiraphTypeValidator.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/job/GiraphTypeValidator.java b/giraph-core/src/main/java/org/apache/giraph/job/GiraphTypeValidator.java
deleted file mode 100644
index de2a66d..0000000
--- a/giraph-core/src/main/java/org/apache/giraph/job/GiraphTypeValidator.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.giraph.job;
-
-import org.apache.giraph.bsp.BspUtils;
-import org.apache.giraph.combiner.Combiner;
-import org.apache.giraph.graph.DefaultVertexResolver;
-import org.apache.giraph.graph.VertexResolver;
-import org.apache.giraph.io.EdgeInputFormat;
-import org.apache.giraph.io.VertexInputFormat;
-import org.apache.giraph.io.VertexOutputFormat;
-import org.apache.giraph.utils.ReflectionUtils;
-import org.apache.giraph.vertex.Vertex;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.log4j.Logger;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * GiraphTypeValidator attempts to verify the consistency of
- * user-chosen InputFormat, OutputFormat, and Vertex type
- * parameters before the job run actually begins.
- *
- * @param <I> the Vertex ID type
- * @param <V> the Vertex Value type
- * @param <E> the Edge Value type
- * @param <M> the Message type
- */
-public class GiraphTypeValidator<I extends WritableComparable,
- V extends Writable, E extends Writable, M extends Writable> {
- /**
- * Class logger object.
- */
- private static Logger LOG =
- Logger.getLogger(GiraphTypeValidator.class);
-
- /** I param vertex index in classList */
- private static final int ID_PARAM_INDEX = 0;
- /** V param vertex index in classList */
- private static final int VALUE_PARAM_INDEX = 1;
- /** E param vertex index in classList */
- private static final int EDGE_PARAM_INDEX = 2;
- /** M param vertex index in classList */
- private static final int MSG_PARAM_INDEX = 3;
- /** M param vertex combiner index in classList */
- private static final int MSG_COMBINER_PARAM_INDEX = 1;
- /** E param edge input format index in classList */
- private static final int EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX = 1;
-
- /** Vertex Index Type */
- private Type vertexIndexType;
- /** Vertex Index Type */
- private Type vertexValueType;
- /** Vertex Index Type */
- private Type edgeValueType;
- /** Vertex Index Type */
- private Type messageValueType;
-
- /**
- * The Configuration object for use in the validation test.
- */
- private Configuration conf;
-
- /**
- * Constructor to execute the validation test, throws
- * unchecked exception to end job run on failure.
- *
- * @param conf the Configuration for this run.
- */
- public GiraphTypeValidator(Configuration conf) {
- this.conf = conf;
- }
-
- /**
- * Make sure that all registered classes have matching types. This
- * is a little tricky due to type erasure, cannot simply get them from
- * the class type arguments. Also, set the vertex index, vertex value,
- * edge value and message value classes.
- */
- public void validateClassTypes() {
- Class<? extends Vertex<I, V, E, M>> vertexClass =
- BspUtils.<I, V, E, M>getVertexClass(conf);
- List<Class<?>> classList = ReflectionUtils.getTypeArguments(
- Vertex.class, vertexClass);
- vertexIndexType = classList.get(ID_PARAM_INDEX);
- vertexValueType = classList.get(VALUE_PARAM_INDEX);
- edgeValueType = classList.get(EDGE_PARAM_INDEX);
- messageValueType = classList.get(MSG_PARAM_INDEX);
- verifyVertexInputFormatGenericTypes();
- verifyEdgeInputFormatGenericTypes();
- verifyVertexOutputFormatGenericTypes();
- verifyVertexResolverGenericTypes();
- verifyVertexCombinerGenericTypes();
- }
-
- /** Verify matching generic types in VertexInputFormat. */
- private void verifyVertexInputFormatGenericTypes() {
- Class<? extends VertexInputFormat<I, V, E, M>> vertexInputFormatClass =
- BspUtils.<I, V, E, M>getVertexInputFormatClass(conf);
- if (vertexInputFormatClass != null) {
- List<Class<?>> classList =
- ReflectionUtils.getTypeArguments(
- VertexInputFormat.class, vertexInputFormatClass);
- if (classList.get(ID_PARAM_INDEX) == null) {
- LOG.warn("Input format vertex index type is not known");
- } else if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex index types don't match, " +
- "vertex - " + vertexIndexType +
- ", vertex input format - " + classList.get(ID_PARAM_INDEX));
- }
- if (classList.get(VALUE_PARAM_INDEX) == null) {
- LOG.warn("Input format vertex value type is not known");
- } else if (!vertexValueType.equals(classList.get(VALUE_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex value types don't match, " +
- "vertex - " + vertexValueType +
- ", vertex input format - " + classList.get(VALUE_PARAM_INDEX));
- }
- if (classList.get(EDGE_PARAM_INDEX) == null) {
- LOG.warn("Input format edge value type is not known");
- } else if (!edgeValueType.equals(classList.get(EDGE_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Edge value types don't match, " +
- "vertex - " + edgeValueType +
- ", vertex input format - " + classList.get(EDGE_PARAM_INDEX));
- }
- }
- }
-
- /** Verify matching generic types in EdgeInputFormat. */
- private void verifyEdgeInputFormatGenericTypes() {
- Class<? extends EdgeInputFormat<I, E>> edgeInputFormatClass =
- BspUtils.<I, E>getEdgeInputFormatClass(conf);
- if (edgeInputFormatClass != null) {
- List<Class<?>> classList =
- ReflectionUtils.getTypeArguments(
- EdgeInputFormat.class, edgeInputFormatClass);
- if (classList.get(ID_PARAM_INDEX) == null) {
- LOG.warn("Input format vertex index type is not known");
- } else if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex index types don't match, " +
- "vertex - " + vertexIndexType +
- ", edge input format - " + classList.get(ID_PARAM_INDEX));
- }
- if (classList.get(EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX) == null) {
- LOG.warn("Input format edge value type is not known");
- } else if (!edgeValueType.equals(
- classList.get(EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Edge value types don't match, " +
- "vertex - " + edgeValueType +
- ", edge input format - " +
- classList.get(EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX));
- }
- }
- }
-
- /** If there is a combiner type, verify its generic params match the job. */
- private void verifyVertexCombinerGenericTypes() {
- Class<? extends Combiner<I, M>> vertexCombinerClass =
- BspUtils.<I, M>getCombinerClass(conf);
- if (vertexCombinerClass != null) {
- List<Class<?>> classList =
- ReflectionUtils.getTypeArguments(
- Combiner.class, vertexCombinerClass);
- if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex index types don't match, " +
- "vertex - " + vertexIndexType +
- ", vertex combiner - " + classList.get(ID_PARAM_INDEX));
- }
- if (!messageValueType.equals(classList.get(MSG_COMBINER_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Message value types don't match, " +
- "vertex - " + messageValueType +
- ", vertex combiner - " + classList.get(MSG_COMBINER_PARAM_INDEX));
- }
- }
- }
-
- /** Verify that the output format's generic params match the job. */
- private void verifyVertexOutputFormatGenericTypes() {
- Class<? extends VertexOutputFormat<I, V, E>>
- vertexOutputFormatClass =
- BspUtils.<I, V, E>getVertexOutputFormatClass(conf);
- if (vertexOutputFormatClass != null) {
- List<Class<?>> classList =
- ReflectionUtils.getTypeArguments(
- VertexOutputFormat.class, vertexOutputFormatClass);
- if (classList.get(ID_PARAM_INDEX) == null) {
- LOG.warn("Output format vertex index type is not known");
- } else if (!vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex index types don't match, " +
- "vertex - " + vertexIndexType +
- ", vertex output format - " + classList.get(ID_PARAM_INDEX));
- }
- if (classList.get(VALUE_PARAM_INDEX) == null) {
- LOG.warn("Output format vertex value type is not known");
- } else if (!vertexValueType.equals(classList.get(VALUE_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex value types don't match, " +
- "vertex - " + vertexValueType +
- ", vertex output format - " + classList.get(VALUE_PARAM_INDEX));
- }
- if (classList.get(EDGE_PARAM_INDEX) == null) {
- LOG.warn("Output format edge value type is not known");
- } else if (!edgeValueType.equals(classList.get(EDGE_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Edge value types don't match, " +
- "vertex - " + edgeValueType +
- ", vertex output format - " + classList.get(EDGE_PARAM_INDEX));
- }
- }
- }
-
- /** If there is a vertex resolver,
- * validate the generic parameter types. */
- private void verifyVertexResolverGenericTypes() {
- Class<? extends VertexResolver<I, V, E, M>>
- vrClass = BspUtils.<I, V, E, M>getVertexResolverClass(conf);
- if (!DefaultVertexResolver.class.isAssignableFrom(vrClass)) {
- return;
- }
- Class<? extends DefaultVertexResolver<I, V, E, M>>
- dvrClass =
- (Class<? extends DefaultVertexResolver<I, V, E, M>>) vrClass;
- List<Class<?>> classList =
- ReflectionUtils.getTypeArguments(
- DefaultVertexResolver.class, dvrClass);
- if (classList.get(ID_PARAM_INDEX) != null &&
- !vertexIndexType.equals(classList.get(ID_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex index types don't match, " +
- "vertex - " + vertexIndexType +
- ", vertex resolver - " + classList.get(ID_PARAM_INDEX));
- }
- if (classList.get(VALUE_PARAM_INDEX) != null &&
- !vertexValueType.equals(classList.get(VALUE_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Vertex value types don't match, " +
- "vertex - " + vertexValueType +
- ", vertex resolver - " + classList.get(VALUE_PARAM_INDEX));
- }
- if (classList.get(EDGE_PARAM_INDEX) != null &&
- !edgeValueType.equals(classList.get(EDGE_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Edge value types don't match, " +
- "vertex - " + edgeValueType +
- ", vertex resolver - " + classList.get(EDGE_PARAM_INDEX));
- }
- if (classList.get(MSG_PARAM_INDEX) != null &&
- !messageValueType.equals(classList.get(MSG_PARAM_INDEX))) {
- throw new IllegalArgumentException(
- "checkClassTypes: Message value types don't match, " +
- "vertex - " + messageValueType +
- ", vertex resolver - " + classList.get(MSG_PARAM_INDEX));
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java b/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
new file mode 100644
index 0000000..5e744a6
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.utils;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.giraph.aggregators.AggregatorWriter;
+import org.apache.giraph.combiner.Combiner;
+import org.apache.giraph.conf.GiraphConfiguration;
+import org.apache.giraph.Algorithm;
+import org.apache.giraph.conf.GiraphConstants;
+import org.apache.giraph.io.formats.GiraphFileInputFormat;
+import org.apache.giraph.job.GiraphConfigurationValidator;
+import org.apache.giraph.io.EdgeInputFormat;
+import org.apache.giraph.io.VertexInputFormat;
+import org.apache.giraph.io.VertexOutputFormat;
+import org.apache.giraph.master.MasterCompute;
+import org.apache.giraph.vertex.Vertex;
+import org.apache.giraph.worker.WorkerContext;
+import org.apache.hadoop.fs.Path;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.zookeeper.ZooKeeper;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Translate command line args into Configuration Key-Value pairs.
+ */
+public final class ConfigurationUtils {
+ /** Class logger */
+ private static final Logger LOG =
+ Logger.getLogger(ConfigurationUtils.class);
+ /** The base path for output dirs as saved in GiraphConfiguration */
+ private static final Path BASE_OUTPUT_DIR =
+ new Path("hdfs://user/" + System.getenv("USER"));
+ /** Maintains our accepted options in case the caller wants to add some */
+ private static Options OPTIONS;
+ static {
+ OPTIONS = new Options();
+ OPTIONS.addOption("h", "help", false, "Help");
+ OPTIONS.addOption("la", "listAlgorithms", false, "List supported " +
+ "algorithms");
+ OPTIONS.addOption("q", "quiet", false, "Quiet output");
+ OPTIONS.addOption("w", "workers", true, "Number of workers");
+ OPTIONS.addOption("vif", "vertexInputFormat", true, "Vertex input format");
+ OPTIONS.addOption("eif", "edgeInputFormat", true, "Edge input format");
+ OPTIONS.addOption("of", "outputFormat", true, "Vertex output format");
+ OPTIONS.addOption("vip", "vertexInputPath", true, "Vertex input path");
+ OPTIONS.addOption("eip", "edgeInputPath", true, "Edge input path");
+ OPTIONS.addOption("op", "outputPath", true, "Vertex output path");
+ OPTIONS.addOption("c", "combiner", true, "Combiner class");
+ OPTIONS.addOption("wc", "workerContext", true, "WorkerContext class");
+ OPTIONS.addOption("aw", "aggregatorWriter", true, "AggregatorWriter class");
+ OPTIONS.addOption("mc", "masterCompute", true, "MasterCompute class");
+ OPTIONS.addOption("cf", "cacheFile", true, "Files for distributed cache");
+ OPTIONS.addOption("ca", "customArguments", true, "provide custom" +
+ " arguments for the job configuration in the form:" +
+ " -ca <param1>=<value1>,<param2>=<value2> -ca <param3>=<value3> etc." +
+ " It can appear multiple times, and the last one has effect" +
+ " for the same param.");
+ }
+
+ /**
+ * No constructing this utility class
+ */
+ private ConfigurationUtils() { }
+
+ /**
+ * Translate CLI arguments to GiraphRunner or 'bin/hadoop jar' into
+ * Configuration Key-Value pairs.
+ * @param giraphConf the current job Configuration.
+ * @param args the raw CLI args to parse
+ * @return a CommandLine object, or null if the job run should exit.
+ */
+ public static CommandLine parseArgs(final GiraphConfiguration giraphConf,
+ final String[] args) throws ClassNotFoundException, ParseException,
+ IOException {
+ // verify we have args at all (can't run without them!)
+ if (args.length == 0) {
+ throw new IllegalArgumentException("No arguments were provided (try -h)");
+ }
+ CommandLineParser parser = new BasicParser();
+ CommandLine cmd = parser.parse(OPTIONS, args);
+
+ // simply printing help or info, return normally but kill job run
+ if (cmd.hasOption("h")) {
+ printHelp();
+ return null;
+ }
+ if (cmd.hasOption("la")) {
+ printSupportedAlgorithms();
+ return null;
+ }
+
+ // Be certain that there are no critical args missing, die if so.
+ performSanityCheck(cmd);
+
+ // Args are OK; attempt to populate the GiraphConfiguration with them.
+ final String vertexClassName = args[0];
+ final int workers = Integer.parseInt(cmd.getOptionValue('w'));
+ populateGiraphConfiguration(giraphConf, cmd, vertexClassName, workers);
+
+ // validate generic parameters chosen are correct or
+ // throw IllegalArgumentException, halting execution.
+ @SuppressWarnings("rawtypes")
+ GiraphConfigurationValidator<?, ?, ?, ?> gtv =
+ new GiraphConfigurationValidator(giraphConf);
+ gtv.validateConfiguration();
+
+ // successfully populated/validated GiraphConfiguration, ready to run job
+ return cmd;
+ }
+
+ /**
+ * Callers can place additional options to be parsed and stored in our job's
+ * GiraphConfiguration via this utility call. These options will ONLY be
+ * parsed and placed into the CommandLine returned from <code>parseArgs</code>
+ * Calling code must query this CommandLine to take action on these options.
+ * @param opt short options name, i.e. -h
+ * @param longOpt long option name, i.e. --help
+ * @param hasArg should we expect an argument for this option?
+ * @param description English description of this option.
+ */
+ public static void addOption(final String opt, final String longOpt,
+ final boolean hasArg, final String description) {
+ if (OPTIONS.hasOption(opt)) {
+ printHelp();
+ throw new IllegalArgumentException("GiraphConfiguration already " +
+ "provides a '" + opt + "' option, please choose another identifier.");
+ }
+ OPTIONS.addOption(opt, longOpt, hasArg, description);
+ }
+
+ /**
+ * Utility to check mission-critical args are populated. The validity of
+ * the values provided in these args is checked elsewhere.
+ * @param cmd our parsed CommandLine
+ */
+ private static void performSanityCheck(final CommandLine cmd) {
+ // Verify all the required options have been provided
+ if (!cmd.hasOption("w")) {
+ throw new IllegalArgumentException("Need to choose the " +
+ "number of workers (-w)");
+ }
+ if (!cmd.hasOption("vif") && !cmd.hasOption("eif")) {
+ throw new IllegalArgumentException("Need to set an input " +
+ "format (-vif or -eif)");
+ }
+ }
+
+ /**
+ * Populate GiraphConfiguration for this job with all cmd line args found.
+ * Any global configuration data that Giraph on any platform might need
+ * should be captured here.
+ * @param giraphConfiguration config for this job run
+ * @param cmd parsed command line options to store in giraphConfiguration
+ * @param vertexClassName the vertex class (application) to run in this job.
+ * @param workers the number of worker tasks for this job run.
+ */
+ private static void populateGiraphConfiguration(final GiraphConfiguration
+ giraphConfiguration, final CommandLine cmd, final String vertexClassName,
+ final int workers) throws ClassNotFoundException, IOException {
+ giraphConfiguration.setWorkerConfiguration(workers, workers, 100.0f);
+ giraphConfiguration.setVertexClass(
+ (Class<? extends Vertex>) Class.forName(vertexClassName));
+ if (cmd.hasOption("c")) {
+ giraphConfiguration.setVertexCombinerClass(
+ (Class<? extends Combiner>)
+ Class.forName(cmd.getOptionValue("c")));
+ }
+ if (cmd.hasOption("wc")) {
+ giraphConfiguration.setWorkerContextClass(
+ (Class<? extends WorkerContext>)
+ Class.forName(cmd.getOptionValue("wc")));
+ }
+ if (cmd.hasOption("mc")) {
+ giraphConfiguration.setMasterComputeClass(
+ (Class<? extends MasterCompute>)
+ Class.forName(cmd.getOptionValue("mc")));
+ }
+ if (cmd.hasOption("aw")) {
+ giraphConfiguration.setAggregatorWriterClass(
+ (Class<? extends AggregatorWriter>)
+ Class.forName(cmd.getOptionValue("aw")));
+ }
+ if (cmd.hasOption("vif")) {
+ giraphConfiguration.setVertexInputFormatClass(
+ (Class<? extends VertexInputFormat>)
+ Class.forName(cmd.getOptionValue("vif")));
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("No vertex input format specified. Ensure your " +
+ "InputFormat does not require one.");
+ }
+ }
+ if (cmd.hasOption("eif")) {
+ giraphConfiguration.setEdgeInputFormatClass(
+ (Class<? extends EdgeInputFormat>)
+ Class.forName(cmd.getOptionValue("eif")));
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("No edge input format specified. Ensure your " +
+ "InputFormat does not require one.");
+ }
+ }
+ if (cmd.hasOption("of")) {
+ giraphConfiguration.setVertexOutputFormatClass(
+ (Class<? extends VertexOutputFormat>)
+ Class.forName(cmd.getOptionValue("of")));
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("No output format specified. Ensure your OutputFormat " +
+ "does not require one.");
+ }
+ }
+ if (cmd.hasOption("ca")) {
+ for (String caOptionValue : cmd.getOptionValues("ca")) {
+ for (String paramValue :
+ Splitter.on(',').split(caOptionValue)) {
+ String[] parts = Iterables.toArray(Splitter.on('=').split(paramValue),
+ String.class);
+ if (parts.length != 2) {
+ throw new IllegalArgumentException("Unable to parse custom " +
+ " argument: " + paramValue);
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Setting custom argument [" + parts[0] + "] to [" +
+ parts[1] + "] in GiraphConfiguration");
+ }
+ giraphConfiguration.set(parts[0], parts[1]);
+ }
+ }
+ }
+ // Now, we parse options that are specific to Hadoop MR Job
+ if (cmd.hasOption("vif")) {
+ if (cmd.hasOption("vip")) {
+ GiraphFileInputFormat.addVertexInputPath(giraphConfiguration,
+ new Path(cmd.getOptionValue("vip")));
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("No input path for vertex data was specified. Ensure your " +
+ "InputFormat does not require one.");
+ }
+ }
+ }
+ if (cmd.hasOption("eif")) {
+ if (cmd.hasOption("eip")) {
+ GiraphFileInputFormat.addEdgeInputPath(giraphConfiguration,
+ new Path(cmd.getOptionValue("eip")));
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("No input path for edge data was specified. Ensure your " +
+ "InputFormat does not require one.");
+ }
+ }
+ }
+ if (cmd.hasOption("of")) {
+ if (cmd.hasOption("op")) {
+ Path outputDir = new Path(BASE_OUTPUT_DIR, cmd.getOptionValue("op"));
+ giraphConfiguration.set(
+ GiraphConstants.GIRAPH_OUTPUT_DIR, outputDir.toString());
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("No output path specified. Ensure your OutputFormat " +
+ "does not require one.");
+ }
+ }
+ }
+ }
+
+ /**
+ * Utility to print CLI help messsage for registered options.
+ */
+ private static void printHelp() {
+ HelpFormatter formatter = new HelpFormatter();
+ formatter.printHelp(ConfigurationUtils.class.getName(), OPTIONS, true);
+ }
+
+ /**
+ * Prints description of algorithms annotated with
+ * {@link org.apache.giraph.Algorithm}
+ */
+ private static void printSupportedAlgorithms() {
+ Logger.getLogger(ZooKeeper.class).setLevel(Level.OFF);
+
+ List<Class<?>> classes = AnnotationUtils.getAnnotatedClasses(
+ Algorithm.class, "org.apache.giraph");
+ System.out.print(" Supported algorithms:\n");
+ for (Class<?> clazz : classes) {
+ if (Vertex.class.isAssignableFrom(clazz)) {
+ Algorithm algorithm = clazz.getAnnotation(Algorithm.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(algorithm.name()).append(" - ").append(clazz.getName())
+ .append("\n");
+ if (!algorithm.description().equals("")) {
+ sb.append(" ").append(algorithm.description()).append("\n");
+ }
+ System.out.print(sb.toString());
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java b/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java
index ae8ebf3..889798f 100644
--- a/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java
+++ b/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java
@@ -160,11 +160,11 @@ public class InternalVertexRunner {
Job internalJob = job.getInternalJob();
if (classes.hasVertexInputFormat()) {
- GiraphFileInputFormat.addVertexInputPath(internalJob,
+ GiraphFileInputFormat.addVertexInputPath(internalJob.getConfiguration(),
new Path(vertexInputFile.toString()));
}
if (classes.hasEdgeInputFormat()) {
- GiraphFileInputFormat.addEdgeInputPath(internalJob,
+ GiraphFileInputFormat.addEdgeInputPath(internalJob.getConfiguration(),
new Path(edgeInputFile.toString()));
}
FileOutputFormat.setOutputPath(job.getInternalJob(),
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-core/src/test/java/org/apache/giraph/io/TestJsonBase64Format.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/test/java/org/apache/giraph/io/TestJsonBase64Format.java b/giraph-core/src/test/java/org/apache/giraph/io/TestJsonBase64Format.java
index e2f6fd3..f4d97a4 100644
--- a/giraph-core/src/test/java/org/apache/giraph/io/TestJsonBase64Format.java
+++ b/giraph-core/src/test/java/org/apache/giraph/io/TestJsonBase64Format.java
@@ -80,7 +80,8 @@ public class TestJsonBase64Format extends BspCase {
classes.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
job = prepareJob(getCallingMethodName(), classes, outputPath2);
job.getConfiguration().setInt(PageRankComputation.SUPERSTEP_COUNT, 3);
- GiraphFileInputFormat.addVertexInputPath(job.getInternalJob(), outputPath);
+ GiraphFileInputFormat.addVertexInputPath(
+ job.getInternalJob().getConfiguration(), outputPath);
assertTrue(job.run(true));
Path outputPath3 = getTempPath(getCallingMethodName() + "3");
http://git-wip-us.apache.org/repos/asf/giraph/blob/2bdc2389/giraph-examples/src/test/java/org/apache/giraph/vertex/TestVertexTypes.java
----------------------------------------------------------------------
diff --git a/giraph-examples/src/test/java/org/apache/giraph/vertex/TestVertexTypes.java b/giraph-examples/src/test/java/org/apache/giraph/vertex/TestVertexTypes.java
index 80187ef..bcfbd39 100644
--- a/giraph-examples/src/test/java/org/apache/giraph/vertex/TestVertexTypes.java
+++ b/giraph-examples/src/test/java/org/apache/giraph/vertex/TestVertexTypes.java
@@ -21,7 +21,7 @@ package org.apache.giraph.vertex;
import org.apache.giraph.conf.GiraphConstants;
import org.apache.giraph.examples.SimpleSuperstepVertex.SimpleSuperstepVertexInputFormat;
import org.apache.giraph.combiner.Combiner;
-import org.apache.giraph.job.GiraphTypeValidator;
+import org.apache.giraph.job.GiraphConfigurationValidator;
import org.apache.giraph.io.VertexInputFormat;
import org.apache.giraph.io.VertexOutputFormat;
import org.apache.giraph.io.formats.GeneratedVertexInputFormat;
@@ -103,10 +103,23 @@ public class TestVertexTypes {
}
}
+ /**
+ * Just populate a conf with testing defaults that won't
+ * upset the GiraphConfigurationValidator.
+ * */
+ private Configuration getDefaultTestConf() {
+ Configuration conf = new Configuration();
+ conf.setInt(GiraphConstants.MAX_WORKERS, 1);
+ conf.setInt(GiraphConstants.MIN_WORKERS, 1);
+ conf.set(GiraphConstants.VERTEX_INPUT_FORMAT_CLASS,
+ "org.apache.giraph.io.formats.DUMMY_TEST_VALUE");
+ return conf;
+ }
+
@Test
public void testMatchingType() throws SecurityException,
NoSuchMethodException, NoSuchFieldException {
- Configuration conf = new Configuration();
+ Configuration conf = getDefaultTestConf();
conf.setClass(GiraphConstants.VERTEX_CLASS,
GeneratedVertexMatch.class,
Vertex.class);
@@ -117,15 +130,15 @@ public class TestVertexTypes {
GeneratedVertexMatchCombiner.class,
Combiner.class);
@SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(conf);
- validator.validateClassTypes();
+ GiraphConfigurationValidator<?, ?, ?, ?> validator =
+ new GiraphConfigurationValidator(conf);
+ validator.validateConfiguration();
}
@Test
public void testDerivedMatchingType() throws SecurityException,
NoSuchMethodException, NoSuchFieldException {
- Configuration conf = new Configuration();
+ Configuration conf = getDefaultTestConf() ;
conf.setClass(GiraphConstants.VERTEX_CLASS,
DerivedVertexMatch.class,
Vertex.class);
@@ -133,15 +146,15 @@ public class TestVertexTypes {
SimpleSuperstepVertexInputFormat.class,
VertexInputFormat.class);
@SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(conf);
- validator.validateClassTypes();
+ GiraphConfigurationValidator<?, ?, ?, ?> validator =
+ new GiraphConfigurationValidator(conf);
+ validator.validateConfiguration();
}
@Test
public void testDerivedInputFormatType() throws SecurityException,
NoSuchMethodException, NoSuchFieldException {
- Configuration conf = new Configuration();
+ Configuration conf = getDefaultTestConf() ;
conf.setClass(GiraphConstants.VERTEX_CLASS,
DerivedVertexMatch.class,
Vertex.class);
@@ -149,15 +162,15 @@ public class TestVertexTypes {
SimpleSuperstepVertexInputFormat.class,
VertexInputFormat.class);
@SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(conf);
- validator.validateClassTypes();
+ GiraphConfigurationValidator<?, ?, ?, ?> validator =
+ new GiraphConfigurationValidator(conf);
+ validator.validateConfiguration();
}
@Test(expected = IllegalArgumentException.class)
public void testMismatchingVertex() throws SecurityException,
NoSuchMethodException, NoSuchFieldException {
- Configuration conf = new Configuration();
+ Configuration conf = getDefaultTestConf() ;
conf.setClass(GiraphConstants.VERTEX_CLASS,
GeneratedVertexMismatch.class,
Vertex.class);
@@ -165,15 +178,15 @@ public class TestVertexTypes {
SimpleSuperstepVertexInputFormat.class,
VertexInputFormat.class);
@SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(conf);
- validator.validateClassTypes();
+ GiraphConfigurationValidator<?, ?, ?, ?> validator =
+ new GiraphConfigurationValidator(conf);
+ validator.validateConfiguration();
}
@Test(expected = IllegalArgumentException.class)
public void testMismatchingCombiner() throws SecurityException,
NoSuchMethodException, NoSuchFieldException {
- Configuration conf = new Configuration();
+ Configuration conf = getDefaultTestConf() ;
conf.setClass(GiraphConstants.VERTEX_CLASS,
GeneratedVertexMatch.class, Vertex.class);
conf.setClass(GiraphConstants.VERTEX_INPUT_FORMAT_CLASS,
@@ -183,15 +196,15 @@ public class TestVertexTypes {
GeneratedVertexMismatchCombiner.class,
Combiner.class);
@SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(conf);
- validator.validateClassTypes();
+ GiraphConfigurationValidator<?, ?, ?, ?> validator =
+ new GiraphConfigurationValidator(conf);
+ validator.validateConfiguration();
}
@Test
public void testJsonBase64FormatType() throws SecurityException,
NoSuchMethodException, NoSuchFieldException {
- Configuration conf = new Configuration();
+ Configuration conf = getDefaultTestConf() ;
conf.setClass(GiraphConstants.VERTEX_CLASS,
GeneratedVertexMatch.class,
Vertex.class);
@@ -202,8 +215,8 @@ public class TestVertexTypes {
JsonBase64VertexOutputFormat.class,
VertexOutputFormat.class);
@SuppressWarnings("rawtypes")
- GiraphTypeValidator<?, ?, ?, ?> validator =
- new GiraphTypeValidator(conf);
- validator.validateClassTypes();
+ GiraphConfigurationValidator<?, ?, ?, ?> validator =
+ new GiraphConfigurationValidator(conf);
+ validator.validateConfiguration();
}
}