My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
ProgrammingGuideConfiguration  
SSS Mapreduce Programming Guide - Configuration
en, ja
Updated Feb 27, 2013 by tatsuhik...@gmail.com

Configuration

"Configuration" is the function that the user application passes any settings to Mapper/Reducer executed in remote site and the system of SSS Mapreduce. The following elements have a instance of Configuration class and you can get it with getConfiguration method.

  • SssClient
  • JobEngine
  • SimpleJob
  • Job.Builder
  • Job

When SssClient instance is created, it reads settings from ${MAPREDUCE_HOME}/conf/mapreduce.client.properties and has the settings. When an instance of JobEngine or SimpleJob is created, it copies from "Configuration" of SssClient instance. The instance of Job.Builder copies "Configuration" from JobEngine and the instance of Job copies "Configuration" from Job.Builder. Thus, the user application specifies a setting applied to the whole to SssClient and specifies a setting applied to each elements, such as JobEngine and Job.Builder, to the element.

The parts of the methods to set value to "Configuration" are shown below.

  • void set(String name, String value)
  • void setBoolean(String name, boolean value)
  • void setFloat(String name, float value)
  • void setInt(String name, int value)
  • void setLong(String name, long value)

The example to specify the string "value" to the setting named "setting" in the "Configuration" in SssClient instance is shown below.

  public class UserApplication {
    public static void main(String[] args) throws Exception {
      SssClient client = new SssClient(args);

      client.getConfiguration().set("setting", "value");

If you want to refer "Configuration" in Mapper/Reducer executed in remote side, call Context#getConfiguration with the instance of Context passed as a parameter. The parts of the methods to get value from "Configuration" are shown below.

  • String get(String name)
  • boolean getBoolean(String name)
  • float getFloat(String name)
  • int getInt(String name)
  • long getLong(String name)

The code to get the value of the setting named "setting" in Mapper is shown below.

  public static class UserMapper extends Mapper {
    public void map(Context context,
        PackableInt key, PackableString value,
        Output<PackableString, PackableInt> output) throws Exception {
        String value = context.getConfiguration().get("setting");
        // the processing using "value".
      }
    }
  }

WARNING:

If you modify the settings of "Configuration" in Mapper/Reducer, the modification is not reflected in other Mappers/Reducers.

The explanation about the settings to the system of SSS Mapreduce is described in the explanation about the function related to the setting.

Powered by Google Project Hosting