Versions Compared

Key

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

...

This tutorial requires Hadoop 2.x already correctly installed. If you haven't done this yet, please follow the official documentation https://hadoop.apache.org/docs/stable/

Configuration

Only two properties which are resource manager address and default filesystem uri properties is essentially needed for Hama on YARN. The sample configuration is as follows:

No Format

<!-- Path to your hama-site.xml -->
<configuration>
    <property>
        <name>yarn.resourcemanager.address</name>
        <value>'your resource manager address or hostname':'resource manager port'</value>
    </property>
    <property>
        <name>fs.default.name</name>
        <value>hdfs://'your default file system address or hostname':'default file system port'/</value>
    </property>
</configuration>

See also configuration page for advanced configurations of Hama.

...

No Format
$HAMA_HOME/bin/hama jar hama-yarn-0.7.0-SNAPSHOT.jar org.apache.hama.bsp.YarnSerializePrinting

You should see "Hello BSP Message" Messages which each container spawned in HDFS where you defined output path in your ternimal. If your application is success, you'll be able to got the following message.

No Format

INFO bsp.YARNBSPJobClient: Application has completed successfully. Breaking monitoring loop
Hello BSP from 1 of 4: cluster-0:16004
Hello BSP from 2 of 4: cluster-1:16006
Hello BSP from 3 of 4: cluster-0:16008
Hello BSP from 4 of 4: cluster-1:16010
Job Finished in 14.838 seconds

How to write a Hama-YARN job

BSP job

The BSPModel hasn't changed, but the way to submit a job has.

Basically you just need the following code to submit a Hama-YARN job.

No Format
    HamaConfiguration conf = new HamaConfiguration();
    YARNBSPJob job = new YARNBSPJob(conf);

    job.setBspClass(HelloBSP.class);
    job.setJarByClass(HelloBSP.class);
    job.setJobName("Serialize Printing");
    job.setMemoryUsedPerTaskInMb(50);
    job.setNumBspTask(2);
    job.waitForCompletion(false);

...

No Format
job.setMemoryUsedPerTaskInMb(50);

Graph job

Hama Graph jobs also isn't changed but you should change a little code from GraphJob to YARNGraphJob to run Hama graph job. Let's show the following link, PageRank on YARN.

PageRank on YARN example

Compared to PageRank in existing graph example, this code only is changed from GraphJob to YARNGraphJob. How to launch graph job on YARN is same as existing graph job.

How to submit a job

General

...

to submit a Hama job. You can just change the BSPJob to YARNBSPJob. If you want to submit graph job of Hama, only change BSPJob object to YARNGraphJob.