Examples of GiraphJob


Examples of org.apache.giraph.job.GiraphJob

    Path outputPath = getTempPath(getCallingMethodName());
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(WeightedPageRankVertex.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(WeightedPageRankVertex.SUPERSTEP_COUNT, 2);

    assertTrue(job.run(true));

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

    Path outputPath3 = getTempPath(getCallingMethodName() + "3");
    conf = new GiraphConfiguration();
    conf.setVertexClass(WeightedPageRankVertex.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(WeightedPageRankVertex.SUPERSTEP_COUNT, 5);
    assertTrue(job.run(true));

    assertEquals(101, getNumResults(conf, outputPath));
    assertEquals(101, getNumResults(conf, outputPath2));
    assertEquals(101, getNumResults(conf, outputPath3));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.