コード例 #1
0
  @Test
  public void test() throws Exception {
    TestCluster testCluster = new TestCluster();

    try {
      PregelixJob job = new PregelixJob(PageRankVertex.class.getName());
      job.setVertexClass(PageRankVertex.class);
      job.setVertexInputFormatClass(TextPageRankInputFormat.class);
      job.setVertexOutputFormatClass(SimplePageRankVertexOutputFormat.class);
      job.setMessageCombinerClass(PageRankVertex.SimpleSumCombiner.class);
      job.setNoramlizedKeyComputerClass(VLongNormalizedKeyComputer.class);
      FileInputFormat.setInputPaths(job, INPUTPATH);
      FileOutputFormat.setOutputPath(job, new Path(OUTPUTPAH));
      job.getConfiguration().setLong(PregelixJob.NUM_VERTICE, 20);
      job.setCheckpointHook(ConservativeCheckpointHook.class);
      job.setFixedVertexValueSize(true);
      job.setIterationCompleteReporterHook(FailureInjectionIterationCompleteHook.class);

      testCluster.setUp();
      Driver driver = new Driver(PageRankVertex.class);
      driver.runJob(job, "127.0.0.1", PregelixHyracksIntegrationUtil.TEST_HYRACKS_CC_CLIENT_PORT);

      PregelixTestUtils.compareWithResultDir(new File(EXPECTEDPATH), new File(OUTPUTPAH));
    } catch (Exception e) {
      PregelixHyracksIntegrationUtil.shutdownNC2();
      testCluster.cleanupHDFS();
      throw e;
    }
  }
コード例 #2
0
ファイル: PageRankVertex.java プロジェクト: YoufuLi/pregelix
 public static void main(String[] args) throws Exception {
   PregelixJob job = new PregelixJob(PageRankVertex.class.getSimpleName());
   job.setVertexClass(PageRankVertex.class);
   job.setVertexInputFormatClass(TextPageRankInputFormat.class);
   job.setVertexOutputFormatClass(SimplePageRankVertexOutputFormat.class);
   job.setMessageCombinerClass(PageRankVertex.SimpleSumCombiner.class);
   job.setNoramlizedKeyComputerClass(VLongNormalizedKeyComputer.class);
   job.setFixedVertexValueSize(true);
   job.setSkipCombinerKey(true);
   Client.run(args, job);
 }