Package org.apache.giraph.conf

Examples of org.apache.giraph.conf.GiraphConfiguration


  @Before
  public void setUp() throws IOException, InterruptedException {
    rr = mock(RecordReader.class);
    when(rr.nextKeyValue()).thenReturn(true);
    GiraphConfiguration giraphConf = new GiraphConfiguration();
    giraphConf.setComputationClass(DummyComputation.class);
    conf = new ImmutableClassesGiraphConfiguration<LongWritable, DoubleWritable,
        DoubleWritable>(giraphConf);
    tac = mock(TaskAttemptContext.class);
    when(tac.getConfiguration()).thenReturn(conf);
  }
View Full Code Here


  @Test
  public void getEmptyDb() throws Exception {
    Iterable<String>    results;
    Iterator<String>    result;
    GiraphConfiguration conf    = new GiraphConfiguration();
    GIRAPH_GORA_DATASTORE_CLASS.
    set(conf, "org.apache.gora.memory.store.MemStore");
    GIRAPH_GORA_KEYS_FACTORY_CLASS.
    set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
    GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
    GIRAPH_GORA_PERSISTENT_CLASS.
    set(conf,"org.apache.giraph.io.gora.generated.GEdge");
    GIRAPH_GORA_START_KEY.set(conf,"1");
    GIRAPH_GORA_END_KEY.set(conf,"3");
    conf.set("io.serializations",
        "org.apache.hadoop.io.serializer.JavaSerialization," +
        "org.apache.hadoop.io.serializer.WritableSerialization");
    conf.setComputationClass(EmptyComputation.class);
    conf.setEdgeInputFormatClass(GoraGEdgeEdgeInputFormat.class);
    results = InternalVertexRunner.run(conf, new String[0], new String[0]);
    Assert.assertNotNull(results);
    result = results.iterator();
    Assert.assertFalse(result.hasNext());
  }
View Full Code Here

  }

  @Test
  public void getTestDb() throws Exception {
    Iterable<String>    results;
    GiraphConfiguration conf    = new GiraphConfiguration();
    GIRAPH_GORA_DATASTORE_CLASS.
    set(conf, "org.apache.gora.memory.store.MemStore");
    GIRAPH_GORA_KEYS_FACTORY_CLASS.
    set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
    GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
    GIRAPH_GORA_PERSISTENT_CLASS.
    set(conf,"org.apache.giraph.io.gora.generated.GEdge");
    GIRAPH_GORA_START_KEY.set(conf,"1");
    GIRAPH_GORA_END_KEY.set(conf,"4");
    conf.set("io.serializations",
        "org.apache.hadoop.io.serializer.WritableSerialization," +
        "org.apache.hadoop.io.serializer.JavaSerialization");
    conf.setComputationClass(EmptyComputation.class);
    conf.setEdgeInputFormatClass(GoraTestEdgeInputFormat.class);
    conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
    results = InternalVertexRunner.run(conf, new String[0], new String[0]);
    Assert.assertNotNull(results);
    Assert.assertEquals(3, ((ArrayList<?>)results).size());
    if (results instanceof Collection<?>
    & (((Collection<?>)results).size() == 2)) {
View Full Code Here

      throws InstantiationException, IllegalAccessException,
      IOException, InterruptedException, IllegalArgumentException,
      InvocationTargetException, SecurityException, NoSuchMethodException {
    System.out.println("testInstantiateVertex: java.class.path=" +
        System.getProperty("java.class.path"));
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(SimpleSuperstepComputation.class);
    conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    ImmutableClassesGiraphConfiguration configuration =
        new ImmutableClassesGiraphConfiguration(job.getConfiguration());
    Vertex<LongWritable, IntWritable, FloatWritable> vertex =
        configuration.createVertex();
View Full Code Here

   * Test whether vertices with NullWritable for vertex value type, edge value
   * type and message value type can be instantiated.
   */
  @Test
  public void testInstantiateNullVertex() throws IOException {
    GiraphConfiguration nullConf = new GiraphConfiguration();
    nullConf.setComputationClass(NullComputation.class);
    ImmutableClassesGiraphConfiguration<NullWritable, NullWritable,
        NullWritable> immutableClassesGiraphConfiguration =
        new ImmutableClassesGiraphConfiguration<
            NullWritable, NullWritable, NullWritable>(nullConf);
    NullWritable vertexValue =
View Full Code Here

  @Test
  public void testContinue()
      throws IOException, InterruptedException, ClassNotFoundException {

    Path outputPath = getTempPath(getCallingMethodName());
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(WeightedPageRankComputation.class);
    conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
    conf.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);
    job.getConfiguration().setLong(
        PseudoRandomInputFormatConstants.AGGREGATE_VERTICES, 101);
    job.getConfiguration().setLong(
        PseudoRandomInputFormatConstants.EDGES_PER_VERTEX, 2);
    job.getConfiguration().setInt(
        WeightedPageRankComputation.SUPERSTEP_COUNT, 2);
    assertTrue(job.run(true));

    Path outputPath2 = getTempPath(getCallingMethodName() + "2");
    conf = new GiraphConfiguration();
    conf.setComputationClass(WeightedPageRankComputation.class);
    conf.setVertexInputFormatClass(JsonBase64VertexInputFormat.class);
    conf.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
    job = prepareJob(getCallingMethodName(), conf, outputPath2);
    job.getConfiguration().setInt(
        WeightedPageRankComputation.SUPERSTEP_COUNT, 3);
    GiraphFileInputFormat.addVertexInputPath(
      job.getInternalJob().getConfiguration(), outputPath);
    assertTrue(job.run(true));

    Path outputPath3 = getTempPath(getCallingMethodName() + "3");
    conf = new GiraphConfiguration();
    conf.setComputationClass(WeightedPageRankComputation.class);
    conf.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
    conf.setVertexOutputFormatClass(JsonBase64VertexOutputFormat.class);
    job = prepareJob(getCallingMethodName(), conf, outputPath3);
    conf = job.getConfiguration();
    conf.setLong(PseudoRandomInputFormatConstants.AGGREGATE_VERTICES, 101);
    conf.setLong(PseudoRandomInputFormatConstants.EDGES_PER_VERTEX, 2);
    conf.setInt(
        WeightedPageRankComputation.SUPERSTEP_COUNT, 5);
    assertTrue(job.run(true));

    assertEquals(101, getNumResults(conf, outputPath));
    assertEquals(101, getNumResults(conf, outputPath2));
View Full Code Here

    if (runningInDistributedMode()) {
      System.out.println("testLocalJobRunnerConfig: Skipping for " +
          "non-local");
      return;
    }
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(SimpleSuperstepComputation.class);
    conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    conf = job.getConfiguration();
    conf.setWorkerConfiguration(5, 5, 100.0f);
    GiraphConstants.SPLIT_MASTER_WORKER.set(conf, true);

    try {
      job.run(true);
      fail();
    } catch (IllegalArgumentException e) {
    }

    GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false);
    try {
      job.run(true);
      fail();
    } catch (IllegalArgumentException e) {
    }

    conf.setWorkerConfiguration(1, 1, 100.0f);
    job.run(true);
  }
View Full Code Here

    if (!runningInDistributedMode()) {
      System.out.println("testBspFail: not executed for local setup.");
      return;
    }

    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(SimpleFailComputation.class);
    conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf,
        getTempPath(getCallingMethodName()));
    job.getConfiguration().setInt("mapred.map.max.attempts", 1);
    assertTrue(!job.run(true));
  }
View Full Code Here

  @Test
  public void testBspSuperStep()
      throws IOException, InterruptedException, ClassNotFoundException {
    String callingMethod = getCallingMethodName();
    Path outputPath = getTempPath(callingMethod);
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(SimpleSuperstepComputation.class);
    conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
    conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
    GiraphJob job = prepareJob(callingMethod, conf, outputPath);
    Configuration configuration = job.getConfiguration();
    // GeneratedInputSplit will generate 10 vertices
    GeneratedVertexReader.READER_VERTICES.set(configuration, 10);
    assertTrue(job.run(true));
View Full Code Here

        createConfiguration(IntIntIntIntLongComputation.class), true);
  }

  private static ImmutableClassesGiraphConfiguration createConfiguration(
      Class<? extends Computation> computationClass) {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass(computationClass);
    return new ImmutableClassesGiraphConfiguration(conf);
  }
View Full Code Here

TOP

Related Classes of org.apache.giraph.conf.GiraphConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.