Examples of GiraphJob


Examples of org.apache.giraph.job.GiraphJob

  public void testBspMsg()
      throws IOException, InterruptedException, ClassNotFoundException {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(SimpleMsgVertex.class);
    conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    assertTrue(job.run(true));
  }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

  public void testEmptyVertexInputFormat()
      throws IOException, InterruptedException, ClassNotFoundException {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(SimpleMsgVertex.class);
    conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    job.getConfiguration().setLong(GeneratedVertexReader.READER_VERTICES, 0);
    assertTrue(job.run(true));
  }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

      throws IOException, InterruptedException, ClassNotFoundException {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(SimpleCombinerVertex.class);
    conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
    conf.setCombinerClass(SimpleSumCombiner.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    assertTrue(job.run(true));
  }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

    conf.setVertexClass(SimpleShortestPathsVertex.class);
    conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
    conf.setVertexOutputFormatClass(
        JsonLongDoubleFloatDoubleVertexOutputFormat.class);
    SimpleShortestPathsVertex.SOURCE_ID.set(conf, 0);
    GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);

    assertTrue(job.run(true));

    int numResults = getNumResults(job.getConfiguration(), outputPath);

    int expectedNumResults = runningInDistributedMode() ? 15 : 5;
    assertEquals(expectedNumResults, numResults);
  }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

    conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
    conf.setVertexOutputFormatClass(
        SimplePageRankVertex.SimplePageRankVertexOutputFormat.class);
    conf.setWorkerContextClass(
        SimplePageRankVertex.SimplePageRankVertexWorkerContext.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);
    GiraphConfiguration configuration = job.getConfiguration();
    Path aggregatorValues = getTempPath("aggregatorValues");
    configuration.setInt(TextAggregatorWriter.FREQUENCY,
        TextAggregatorWriter.ALWAYS);
    configuration.set(TextAggregatorWriter.FILENAME,
        aggregatorValues.toString());

    assertTrue(job.run(true));

    FileSystem fs = FileSystem.get(configuration);
    Path valuesFile = new Path(aggregatorValues.toString() + "_0");

    try {
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

    conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
    conf.setMasterComputeClass(
        SimpleMasterComputeVertex.SimpleMasterCompute.class);
    conf.setWorkerContextClass(
        SimpleMasterComputeVertex.SimpleMasterComputeWorkerContext.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    assertTrue(job.run(true));
    if (!runningInDistributedMode()) {
      double finalSum =
          SimpleMasterComputeVertex.SimpleMasterComputeWorkerContext.getFinalSum();
      System.out.println("testBspMasterCompute: finalSum=" + finalSum);
      assertEquals(32.5, finalSum, 0d);
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

          throws IOException, InterruptedException, ClassNotFoundException {
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(InfiniteLoopVertex.class);
    conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class);
    conf.setVertexOutputFormatClass(SimplePageRankVertexOutputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf,
        getTempPath(getCallingMethodName()));
    job.getConfiguration().setMaxNumberOfSupersteps(3);
    assertTrue(job.run(true));
    if (!runningInDistributedMode()) {
      GiraphHadoopCounter superstepCounter =
          GiraphStats.getInstance().getSuperstepCounter();
      assertEquals(superstepCounter.getValue(), 3L);
    }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

  public int run(String[] args) throws Exception {
    if (args.length != 2) {
      throw new IllegalArgumentException(
          "run: Must have 2 arguments <output path> <# of workers>");
    }
    GiraphJob job = new GiraphJob(getConf(), getClass().getName());
    job.getConfiguration().setVertexClass(SimpleVertex.class);
    job.getConfiguration().setVertexInputFormatClass(
        SimpleSuperstepVertexInputFormat.class);
    job.getConfiguration().setWorkerContextClass(EmitterWorkerContext.class);
    job.getConfiguration().set(
        SimpleVertexWithWorkerContext.OUTPUTDIR, args[0]);
    job.getConfiguration().setWorkerConfiguration(Integer.parseInt(args[1]),
        Integer.parseInt(args[1]),
        100.0f);
    if (job.run(true)) {
      return 0;
    } else {
      return -1;
    }
  }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

        SimplePageRankVertex.SimplePageRankVertexInputFormat.class);
    conf.setWorkerContextClass(
        PartitionContextTestVertex.TestPartitionContextWorkerContext.class);
    conf.setPartitionContextClass(
        PartitionContextTestVertex.TestPartitionContextPartitionContext.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    // Use multithreading
    job.getConfiguration().setNumComputeThreads(
        PartitionContextTestVertex.NUM_COMPUTE_THREADS);
    // Increase the number of vertices
    job.getConfiguration().setInt(
        GeneratedVertexReader.READER_VERTICES,
        PartitionContextTestVertex.NUM_VERTICES);
    // Increase the number of partitions
    GiraphConstants.USER_PARTITION_COUNT.set(job.getConfiguration(),
        PartitionContextTestVertex.NUM_PARTITIONS);
    assertTrue(job.run(true));
  }
View Full Code Here

Examples of org.apache.giraph.job.GiraphJob

    conf.setNumComputeThreads(numComputeThreads);
    // Set enough partitions to generate randomness on the compute side
    if (numComputeThreads != 1) {
      GiraphConstants.USER_PARTITION_COUNT.set(conf, numComputeThreads * 5);
    }
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    assertTrue(job.run(true));
    if (!runningInDistributedMode()) {
      double maxPageRank =
          SimplePageRankVertex.SimplePageRankVertexWorkerContext.getFinalMax();
      double minPageRank =
          SimplePageRankVertex.SimplePageRankVertexWorkerContext.getFinalMin();
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.