|
ProgrammingGuideConfiguration
SSS Mapreduce Programming Guide - Configuration
en, ja 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.
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.
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.
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. | |