Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • TODO: explain how to programming BSP program with Hama.
  • work in progress HAMA-244
No Format
public class BSPEaxmple {

  //class BSPMyBSP jobextends configurationBSP {

    BSPJobpublic bsp = new BSPJob(); MyBSP(Configuration conf) throws IOException {
    // Set the job name 
 super(conf);
       bsp.setJobName("BSP test job"); 
// TODO Auto-generated constructor stub
    //}

 Set input/output format classes@Override
    public void bsp.setInputFormat(MyInputFormat.class); (BSPPeer bspPeer) throws IOException, KeeperException,
    bsp.setOutputFormat(MyOutputFormat.class); 

   InterruptedException //{
 Like new MR API, set input//output targetsA withcommunication someand concretesynchronization classesphase of a bothBSP InputFormatsuperstep
    //  
 and OutputFormat. This method provides more// flexibleSend waysdata to specifyneighbor targets.node
    MyInputFormat  bspPeer.addInputPathsend(bsphostname, "/data/data1"msg);

     MyOutputFormat.addOutputPath(bsp, "/result/data1");/ Superstep synchronization
      bspPeer.sync();

      // or we could have another type of input/output targets as follows:
    // MyDBInputFormat.addInputTable(bsp, "hbase://localhost/WebData");    
    // MyDBOutputFormat.addOutputTable(bsp, "hbase://localhost/OutputTable");
      Receive current messages
      bspPeer.getCurrentMessage();
    }
    
  }
  
  // BSP job configuration 
  public void main(String[] args) throws Exception {
    BSPJob bsp = new BSPJob(new HamaConfiguration());
    // Set the BSP code job name
    bsp.setJobName("My BSP Job");
    bsp.setBSPCodesetBspClass(BSPProgramMyBSP.class);

    // Submit job
    bsp.submit();
  }

}  

Examples