本文整理汇总了Java中org.apache.giraph.conf.GiraphConfiguration.setInt方法的典型用法代码示例。如果您正苦于以下问题:Java GiraphConfiguration.setInt方法的具体用法?Java GiraphConfiguration.setInt怎么用?Java GiraphConfiguration.setInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.giraph.conf.GiraphConfiguration
的用法示例。
在下文中一共展示了GiraphConfiguration.setInt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Override
protected void prepareConfiguration(GiraphConfiguration conf,
CommandLine cmd) {
conf.setVertexClass(RandomMessageVertex.class);
conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
conf.setWorkerContextClass(RandomMessageBenchmarkWorkerContext.class);
conf.setMasterComputeClass(RandomMessageBenchmarkMasterCompute.class);
conf.setLong(PseudoRandomInputFormatConstants.AGGREGATE_VERTICES,
BenchmarkOption.VERTICES.getOptionLongValue(cmd));
conf.setLong(PseudoRandomInputFormatConstants.EDGES_PER_VERTEX,
BenchmarkOption.EDGES_PER_VERTEX.getOptionLongValue(cmd));
conf.setInt(SUPERSTEP_COUNT,
BenchmarkOption.SUPERSTEPS.getOptionIntValue(cmd));
conf.setInt(RandomMessageBenchmark.NUM_BYTES_PER_MESSAGE,
BYTES_PER_MESSAGE.getOptionIntValue(cmd));
conf.setInt(RandomMessageBenchmark.NUM_MESSAGES_PER_EDGE,
MESSAGES_PER_EDGE.getOptionIntValue(cmd));
if (FLUSH_THREADS.optionTurnedOn(cmd)) {
conf.setInt(GiraphConstants.MSG_NUM_FLUSH_THREADS,
FLUSH_THREADS.getOptionIntValue(cmd));
}
}
示例2: prepareConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Override
protected void prepareConfiguration(GiraphConfiguration conf,
CommandLine cmd) {
conf.setVertexClass(PageRankVertex.class);
conf.setOutEdgesClass(IntNullArrayEdges.class);
conf.setCombinerClass(FloatSumCombiner.class);
conf.setVertexInputFormatClass(
PseudoRandomIntNullVertexInputFormat.class);
conf.setInt(PseudoRandomInputFormatConstants.AGGREGATE_VERTICES,
BenchmarkOption.VERTICES.getOptionIntValue(cmd));
conf.setInt(PseudoRandomInputFormatConstants.EDGES_PER_VERTEX,
BenchmarkOption.EDGES_PER_VERTEX.getOptionIntValue(cmd));
conf.setInt(PageRankVertex.SUPERSTEP_COUNT,
BenchmarkOption.SUPERSTEPS.getOptionIntValue(cmd));
conf.setFloat(PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO,
BenchmarkOption.LOCAL_EDGES_MIN_RATIO.getOptionFloatValue(cmd,
PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO_DEFAULT));
}
示例3: prepareConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Override
protected void prepareConfiguration(GiraphConfiguration conf,
CommandLine cmd) {
conf.setComputationClass(RandomMessageComputation.class);
conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
conf.setWorkerContextClass(RandomMessageBenchmarkWorkerContext.class);
conf.setMasterComputeClass(RandomMessageBenchmarkMasterCompute.class);
conf.setLong(PseudoRandomInputFormatConstants.AGGREGATE_VERTICES,
BenchmarkOption.VERTICES.getOptionLongValue(cmd));
conf.setLong(PseudoRandomInputFormatConstants.EDGES_PER_VERTEX,
BenchmarkOption.EDGES_PER_VERTEX.getOptionLongValue(cmd));
conf.setInt(SUPERSTEP_COUNT,
BenchmarkOption.SUPERSTEPS.getOptionIntValue(cmd));
conf.setInt(RandomMessageBenchmark.NUM_BYTES_PER_MESSAGE,
BYTES_PER_MESSAGE.getOptionIntValue(cmd));
conf.setInt(RandomMessageBenchmark.NUM_MESSAGES_PER_EDGE,
MESSAGES_PER_EDGE.getOptionIntValue(cmd));
if (FLUSH_THREADS.optionTurnedOn(cmd)) {
conf.setInt(GiraphConstants.MSG_NUM_FLUSH_THREADS,
FLUSH_THREADS.getOptionIntValue(cmd));
}
}
示例4: computeResults
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
private Map<Integer, Integer> computeResults(String[] graph,
int partitionCount, int maxIterations, float capacityTreshold,
int maxStabilization, long seed) throws Exception {
GiraphConfiguration conf = getConfiguration();
conf.setInt(ARPComputation.NUMBER_OF_PARTITIONS, partitionCount);
conf.setInt(ARPComputation.NUMBER_OF_ITERATIONS, maxIterations);
conf.setFloat(ARPComputation.CAPACITY_THRESHOLD, capacityTreshold);
conf.setInt(ARPComputation.NUMBER_OF_STABLE_ITERATIONS, maxStabilization);
conf.setLong(ARPComputation.SEED, seed);
Iterable<String> results = InternalVertexRunner.run(conf, graph);
return parseResults(results);
}
示例5: testSingleFault
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* Run a job that requires checkpointing and will have a worker crash
* and still recover from a previous checkpoint.
*
* @throws IOException
* @throws ClassNotFoundException
* @throws InterruptedException
*/
@Test
public void testSingleFault()
throws IOException, InterruptedException, ClassNotFoundException {
if (!runningInDistributedMode()) {
System.out.println(
"testSingleFault: Ignore this test in local mode.");
return;
}
Path outputPath = getTempPath(getCallingMethodName());
GiraphConfiguration conf = new GiraphConfiguration();
conf.setVertexClass(
SimpleCheckpointVertex.SimpleCheckpointComputation.class);
conf.setWorkerContextClass(
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
conf.setBoolean(SimpleCheckpointVertex.ENABLE_FAULT, true);
conf.setInt("mapred.map.max.attempts", 4);
// Trigger failure faster
conf.setInt("mapred.task.timeout", 10000);
conf.setMaxMasterSuperstepWaitMsecs(10000);
conf.setEventWaitMsecs(1000);
conf.setCheckpointFrequency(2);
GiraphConstants.CHECKPOINT_DIRECTORY.set(conf,
getTempPath("_singleFaultCheckpoints").toString());
GiraphConstants.CLEANUP_CHECKPOINTS_AFTER_SUCCESS.set(conf, false);
GiraphConstants.ZOOKEEPER_SESSION_TIMEOUT.set(conf, 10000);
GiraphConstants.ZOOKEEPER_MIN_SESSION_TIMEOUT.set(conf, 10000);
GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);
assertTrue(job.run(true));
}
示例6: prepareConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Override
protected void prepareConfiguration(GiraphConfiguration conf,
CommandLine cmd) {
conf.setVertexClass(AggregatorsBenchmarkVertex.class);
conf.setMasterComputeClass(AggregatorsBenchmarkMasterCompute.class);
conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
conf.setWorkerContextClass(AggregatorsBenchmarkWorkerContext.class);
conf.setLong(PseudoRandomInputFormatConstants.AGGREGATE_VERTICES,
BenchmarkOption.VERTICES.getOptionLongValue(cmd));
conf.setLong(PseudoRandomInputFormatConstants.EDGES_PER_VERTEX, 1);
conf.setInt(AGGREGATORS_NUM, AGGREGATORS.getOptionIntValue(cmd));
conf.setInt("workers", conf.getInt(GiraphConstants.MAX_WORKERS, -1));
}
示例7: testToyData
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* A local integration test on toy data
*/
@Test
public void testToyData() throws Exception {
// A small graph
String[] graph = new String[] { "12 34 56", "34 78", "56 34 78", "78 34" };
GiraphConfiguration conf = new GiraphConfiguration();
conf.setInt(RandomWalkWithRestartComputation.SOURCE_VERTEX, 12);
conf.setInt(RandomWalkWithRestartComputation.MAX_SUPERSTEPS, 30);
conf.setFloat(
RandomWalkWithRestartComputation.TELEPORTATION_PROBABILITY, 0.25f);
conf.setComputationClass(RandomWalkWithRestartComputation.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(LongDoubleDoubleTextInputFormat.class);
conf.setVertexOutputFormatClass(
VertexWithDoubleValueDoubleEdgeTextOutputFormat.class);
conf.setWorkerContextClass(RandomWalkWorkerContext.class);
conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
// Run internally
Iterable<String> results = InternalVertexRunner.run(conf, graph);
Map<Long, Double> steadyStateProbabilities =
RandomWalkTestUtils.parseSteadyStateProbabilities(results);
// values computed with external software
// 0.25, 0.354872, 0.09375, 0.301377
assertEquals(0.25, steadyStateProbabilities.get(12L), RandomWalkTestUtils.EPSILON);
assertEquals(0.354872, steadyStateProbabilities.get(34L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.09375, steadyStateProbabilities.get(56L), RandomWalkTestUtils.EPSILON);
assertEquals(0.301377, steadyStateProbabilities.get(78L),
RandomWalkTestUtils.EPSILON);
}
示例8: testWeightedGraph
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* A local integration test on toy data
*/
@Test
public void testWeightedGraph() throws Exception {
// A small graph
String[] graph =
new String[] { "12 34:0.1 56:0.9", "34 78:0.9 56:0.1",
"56 12:0.1 34:0.8 78:0.1", "78 34:1.0" };
GiraphConfiguration conf = new GiraphConfiguration();
conf.setInt(RandomWalkWithRestartComputation.SOURCE_VERTEX, 12);
conf.setInt(RandomWalkWithRestartComputation.MAX_SUPERSTEPS, 30);
conf.setFloat(
RandomWalkWithRestartComputation.TELEPORTATION_PROBABILITY, 0.15f);
conf.setComputationClass(RandomWalkWithRestartComputation.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(
NormalizingLongDoubleDoubleTextInputFormat.class);
conf.setVertexOutputFormatClass(
VertexWithDoubleValueDoubleEdgeTextOutputFormat.class);
conf.setWorkerContextClass(RandomWalkWorkerContext.class);
conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
// Run internally
Iterable<String> results = InternalVertexRunner.run(conf, graph);
Map<Long, Double> steadyStateProbabilities =
RandomWalkTestUtils.parseSteadyStateProbabilities(results);
// values computed with external software
// 0.163365, 0.378932, 0.156886, 0.300816
assertEquals(0.163365, steadyStateProbabilities.get(12L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.378932, steadyStateProbabilities.get(34L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.156886, steadyStateProbabilities.get(56L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.300816, steadyStateProbabilities.get(78L),
RandomWalkTestUtils.EPSILON);
}
示例9: testSingleFault
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* Run a job that requires checkpointing and will have a worker crash
* and still recover from a previous checkpoint.
*
* @throws IOException
* @throws ClassNotFoundException
* @throws InterruptedException
*/
@Test
public void testSingleFault()
throws IOException, InterruptedException, ClassNotFoundException {
if (!runningInDistributedMode()) {
System.out.println(
"testSingleFault: Ignore this test in local mode.");
return;
}
Path outputPath = getTempPath(getCallingMethodName());
GiraphConfiguration conf = new GiraphConfiguration();
conf.setComputationClass(
SimpleCheckpoint.SimpleCheckpointComputation.class);
conf.setWorkerContextClass(
SimpleCheckpoint.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpoint.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
conf.setBoolean(SimpleCheckpoint.ENABLE_FAULT, true);
conf.setInt("mapred.map.max.attempts", 4);
// Trigger failure faster
conf.setInt("mapred.task.timeout", 10000);
conf.setMaxMasterSuperstepWaitMsecs(10000);
conf.setEventWaitMsecs(1000);
conf.setCheckpointFrequency(2);
GiraphConstants.CHECKPOINT_DIRECTORY.set(conf,
getTempPath("_singleFaultCheckpoints").toString());
GiraphConstants.CLEANUP_CHECKPOINTS_AFTER_SUCCESS.set(conf, false);
GiraphConstants.ZOOKEEPER_SESSION_TIMEOUT.set(conf, 10000);
GiraphConstants.ZOOKEEPER_MIN_SESSION_TIMEOUT.set(conf, 10000);
GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);
assertTrue(job.run(true));
}
示例10: testWeightedGraph
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* A local integration test on toy data
*/
@Test
public void testWeightedGraph() throws Exception {
// A small graph
String[] graph =
new String[] { "12 34:0.1 56:0.9", "34 78:0.9 56:0.1",
"56 12:0.1 34:0.8 78:0.1", "78 34:1.0" };
GiraphConfiguration conf = new GiraphConfiguration();
conf.setInt(RandomWalkWithRestartVertex.SOURCE_VERTEX, 12);
conf.setInt(RandomWalkWithRestartVertex.MAX_SUPERSTEPS, 30);
conf.setFloat(RandomWalkWithRestartVertex.TELEPORTATION_PROBABILITY, 0.15f);
conf.setVertexClass(RandomWalkWithRestartVertex.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(
NormalizingLongDoubleDoubleTextInputFormat.class);
conf.setVertexOutputFormatClass(
VertexWithDoubleValueDoubleEdgeTextOutputFormat.class);
conf.setWorkerContextClass(RandomWalkWorkerContext.class);
conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
// Run internally
Iterable<String> results = InternalVertexRunner.run(conf, graph);
Map<Long, Double> steadyStateProbabilities =
RandomWalkTestUtils.parseSteadyStateProbabilities(results);
// values computed with external software
// 0.163365, 0.378932, 0.156886, 0.300816
assertEquals(0.163365, steadyStateProbabilities.get(12L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.378932, steadyStateProbabilities.get(34L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.156886, steadyStateProbabilities.get(56L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.300816, steadyStateProbabilities.get(78L),
RandomWalkTestUtils.EPSILON);
}
示例11: testToyData
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* A local integration test on toy data
*/
@Test
public void testToyData() throws Exception {
// A small graph
String[] graph = new String[] {
"1 4 2 3",
"2 1",
"4 3 2",
"5 2 4"
};
GiraphConfiguration conf = new GiraphConfiguration();
conf.setInt(RandomWalkWithRestartVertex.MAX_SUPERSTEPS, 50);
conf.setFloat(RandomWalkWithRestartVertex.TELEPORTATION_PROBABILITY, 0.15f);
conf.setVertexClass(PageRankVertex.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(LongDoubleNullTextInputFormat.class);
conf.setVertexOutputFormatClass(
VertexWithDoubleValueNullEdgeTextOutputFormat.class);
conf.setWorkerContextClass(RandomWalkWorkerContext.class);
conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
// Run internally
Iterable<String> results = InternalVertexRunner.run(conf, graph);
Map<Long, Double> steadyStateProbabilities =
RandomWalkTestUtils.parseSteadyStateProbabilities(results);
assertEquals(0.28159076008518047, steadyStateProbabilities.get(1l),
RandomWalkTestUtils.EPSILON);
assertEquals(0.2514648601529863, steadyStateProbabilities.get(2l),
RandomWalkTestUtils.EPSILON);
assertEquals(0.22262961972286327, steadyStateProbabilities.get(3l),
RandomWalkTestUtils.EPSILON);
assertEquals(0.17646783276703806, steadyStateProbabilities.get(4l),
RandomWalkTestUtils.EPSILON);
assertEquals(0.06784692727193153, steadyStateProbabilities.get(5l),
RandomWalkTestUtils.EPSILON);
}
示例12: testToyData
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* A local integration test on toy data
*/
@Test
public void testToyData() throws Exception {
// A small graph
String[] graph = new String[] { "12 34 56", "34 78", "56 34 78", "78 34" };
GiraphConfiguration conf = new GiraphConfiguration();
conf.setInt(RandomWalkWithRestartVertex.SOURCE_VERTEX, 12);
conf.setInt(RandomWalkWithRestartVertex.MAX_SUPERSTEPS, 30);
conf.setFloat(RandomWalkWithRestartVertex.TELEPORTATION_PROBABILITY, 0.25f);
conf.setVertexClass(RandomWalkWithRestartVertex.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(LongDoubleDoubleTextInputFormat.class);
conf.setVertexOutputFormatClass(
VertexWithDoubleValueDoubleEdgeTextOutputFormat.class);
conf.setWorkerContextClass(RandomWalkWorkerContext.class);
conf.setMasterComputeClass(RandomWalkVertexMasterCompute.class);
// Run internally
Iterable<String> results = InternalVertexRunner.run(conf, graph);
Map<Long, Double> steadyStateProbabilities =
RandomWalkTestUtils.parseSteadyStateProbabilities(results);
// values computed with external software
// 0.25, 0.354872, 0.09375, 0.301377
assertEquals(0.25, steadyStateProbabilities.get(12L), RandomWalkTestUtils.EPSILON);
assertEquals(0.354872, steadyStateProbabilities.get(34L),
RandomWalkTestUtils.EPSILON);
assertEquals(0.09375, steadyStateProbabilities.get(56L), RandomWalkTestUtils.EPSILON);
assertEquals(0.301377, steadyStateProbabilities.get(78L),
RandomWalkTestUtils.EPSILON);
}
示例13: prepareConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* Set vertex edges, input format, partitioner classes and related parameters
* based on command-line arguments.
*
* @param cmd Command line arguments
* @param configuration Giraph job configuration
*/
protected void prepareConfiguration(GiraphConfiguration configuration,
CommandLine cmd) {
configuration.setVertexClass(WeightedPageRankVertex.class);
int edgesClassOption = EDGES_CLASS.getOptionIntValue(cmd, 1);
switch (edgesClassOption) {
case 0:
configuration.setOutEdgesClass(LongDoubleArrayEdges.class);
break;
case 1:
configuration.setOutEdgesClass(ByteArrayEdges.class);
break;
case 2:
configuration.setOutEdgesClass(ByteArrayEdges.class);
configuration.useUnsafeSerialization(true);
break;
case 3:
configuration.setOutEdgesClass(ArrayListEdges.class);
break;
case 4:
configuration.setOutEdgesClass(HashMapEdges.class);
break;
default:
LOG.info("Unknown OutEdges class, " +
"defaulting to LongDoubleArrayEdges");
configuration.setOutEdgesClass(LongDoubleArrayEdges.class);
}
LOG.info("Using edges class " +
GiraphConstants.VERTEX_EDGES_CLASS.get(configuration));
if (COMBINER_TYPE.getOptionIntValue(cmd, 1) == 1) {
configuration.setCombinerClass(DoubleSumCombiner.class);
}
if (EDGE_INPUT.optionTurnedOn(cmd)) {
configuration.setEdgeInputFormatClass(PseudoRandomEdgeInputFormat.class);
} else {
configuration.setVertexInputFormatClass(
PseudoRandomVertexInputFormat.class);
}
configuration.setLong(
PseudoRandomInputFormatConstants.AGGREGATE_VERTICES,
BenchmarkOption.VERTICES.getOptionLongValue(cmd));
configuration.setLong(
PseudoRandomInputFormatConstants.EDGES_PER_VERTEX,
BenchmarkOption.EDGES_PER_VERTEX.getOptionLongValue(cmd));
configuration.setFloat(
PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO,
BenchmarkOption.LOCAL_EDGES_MIN_RATIO.getOptionFloatValue(cmd,
PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO_DEFAULT));
if (OUTPUT_FORMAT.getOptionIntValue(cmd, -1) == 0) {
LOG.info("Using vertex output format class " +
JsonBase64VertexOutputFormat.class.getName());
configuration.setVertexOutputFormatClass(
JsonBase64VertexOutputFormat.class);
}
if (PARTITIONER.getOptionIntValue(cmd, 0) == 1) {
configuration.setGraphPartitionerFactoryClass(
SimpleLongRangePartitionerFactory.class);
}
configuration.setInt(WeightedPageRankVertex.SUPERSTEP_COUNT,
BenchmarkOption.SUPERSTEPS.getOptionIntValue(cmd));
}