You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by Apache Wiki <wi...@apache.org> on 2010/06/04 08:29:09 UTC
[Hama Wiki] Trivial Update of "Architecture" by Edward J. Yoon
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Hama Wiki" for change notification.
The "Architecture" page has been changed by Edward J. Yoon.
http://wiki.apache.org/hama/Architecture?action=diff&rev1=120&rev2=121
--------------------------------------------------
* work in progress [[https://issues.apache.org/jira/browse/HAMA-244|HAMA-244]]
{{{
+ public class BSPEaxmple {
- // BSP job configuration
- BSPJob bsp = new BSPJob();
- // Set the job name
- bsp.setJobName("BSP test job");
+ class MyBSP extends BSP {
- // Set input/output format classes
- bsp.setInputFormat(MyInputFormat.class);
- bsp.setOutputFormat(MyOutputFormat.class);
- // Like new MR API, set input/output targets with some concrete classes of both InputFormat
- // and OutputFormat. This method provides more flexible ways to specify targets.
- MyInputFormat.addInputPath(bsp, "/data/data1");
- MyOutputFormat.addOutputPath(bsp, "/result/data1");
+ public MyBSP(Configuration conf) throws IOException {
+ super(conf);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void bsp(BSPPeer bspPeer) throws IOException, KeeperException,
+ InterruptedException {
+ // A communication and synchronization phase of a BSP superstep
+
+ // Send data to neighbor node
+ bspPeer.send(hostname, msg);
+
+ // Superstep synchronization
+ bspPeer.sync();
+
+ // Receive current messages
+ bspPeer.getCurrentMessage();
+ }
- // or we could have another type of input/output targets as follows:
- // MyDBInputFormat.addInputTable(bsp, "hbase://localhost/WebData");
- // MyDBOutputFormat.addOutputTable(bsp, "hbase://localhost/OutputTable");
-
- // Set the BSP code
- bsp.setBSPCode(BSPProgram.class);
+ }
+
+ // BSP job configuration
+ public void main(String[] args) throws Exception {
+ BSPJob bsp = new BSPJob(new HamaConfiguration());
+ // Set the job name
+ bsp.setJobName("My BSP Job");
+ bsp.setBspClass(MyBSP.class);
+
+ // Submit job
bsp.submit();
+ }
+
+ }
}}}