ExecuteMapReduce

Jobflow Component

Short Description
Ports
Metadata
ExecuteMapReduce Attributes
Details
See also

Short Description

ExecuteMapReduce runs specified MapReduce job on a Hadoop cluster.

[Note]Note

To be able to use this component, you need a separate jobflow license. Also, the component requires your project is executed on CloverETL Server.

Component Same input metadata Sorted inputs Inputs Outputs Each to all outputs Java CTL Auto-propagated metadata
ExecuteMapReduce
no
no
0-10-2
no
no
yes
yes

Icon

Ports

Port typeNumberRequiredDescriptionMetadata
Input0
no
Input tokens with MapReduce job execution settings.Any
Output0
no
Execution information for successful jobs.Any
1
no
Execution information for unsuccessful jobs.Any

Metadata

This component has metadata templates available. See details on Metadata Templates.

ExecuteMapReduce Attributes

AttributeReqDescriptionPossible values
Basic
Hadoop connectionyesHadoop connection which defines both connection to HDFS server (NameNode) and connection to MapReduce server (JobTracker).  
Job nameno Arbitrary label of a job execution. Default value is the name of specified MapReduce .jar file. Any string
URL of JAR file with job classesyes Path to a .jar file with MapReduce job. The file has to be on local file system.  
Timeout (ms)no Time limit for job execution in milliseconds. If job execution time exceeds this limit, the job is killed. Set to 0 (default) for no limit. 0 (unlimited) | positive number
Input mappingno Input mapping defines how data from incoming token overrides default execution settings. CTL transformation
Output mappingno Output mapping maps results of successful MapReduce jobs to the first output port. See Output and error mappings. CTL transformation
Error mappingno Error mapping maps results of unsuccessful jobs to the second output port. See Output and error mappings. CTL transformation
Redirect error outputno By default, results of failed jobs are sent to the second output port (error port). If this switch is true, results of unsuccessful jobs are sent to the first output port in the same way as successful jobs. false (default) | true
Job folders
Input filesyes One or more paths to input files located on HDFS. The path can be in a form of HDFS URL, e.g. hdfs://CONN_ID/path/to/inputfile, where the Hadoop connection ID CONN_ID has to match ID of connection specified in the Hadoop connection attribute, or it can be simply a path on the HDFS, either absolute, e.g. /path/to/inputfile, or relative to job's working directory, e.g. relative/path/to/inputfile.  
Output directoryyes Path to output directory located on HDFS. The directory will be created if it does not already exist (see Clear output directory before execution attribute). HDFS URL or absolute/working-directory-relative path on HDFS can be specified here, just as in the Input files attribute, e.g. hdfs://CONN_ID/path/to/outputdir, /path/to/outputdir, or relative/path/to/outputdir.  
Job's working directoryno Location of working directory of MapReduce job on HDFS. This can be a HDFS URL, e.g. hdfs://CONN_ID/path/to/workdir, or an absolute path on the HDFS, e.g. /path/to/workdir.  
Clear output directory before executionno Indicates whether the Output directory should be deleted before starting the job. If this is set to false and the output directory already exists before job execution, the job will fail to start with error saying that the output directory already exists. false (default) | true
Classes
Job implementation API versionyes Version of API used to implement MapReduce job. If New API is selected (default), classes implementing the job have to extend classes from the org.apache.hadoop.mapreduce package. If Old API is selected, classes implementing the job extend/implement classes/interfaces from the org.apache.hadoop.mapred package. mapreduce (default) | mapred
Mapper classno

Fully qualified name of Java class to be used as mapper of the job. Definition of the class is typically found in the job JAR file.

Depending on selected Job implementation API version the class must extend/implement class/interface from the following table:

Extends/implements
New APIorg.apache.hadoop.mapreduce.Mapper
Old APIorg.apache.hadoop.mapred.Mapper

Following table contains job configuration parameter and Hadoop API method which correspond to setting this component attribute. The ExecuteMapReduce component always directly sets the job configuration parameter according to selected Job implementation API version (listed Java methods are never called and are listed just for comparison).

Job configuration
ParameterNew APImapreduce.map.class
Old APImapred.mapper.class
MethodNew APIJob.setMapperClass(Class)
Old APIJobConf.setMapperClass(Class)

Fully qualified class name, e.g. com.acme.MyMap

Default
New APIorg.apache.hadoop.mapreduce.Mapper
Old APIorg.apache.hadoop.mapred.lib.IdentityReducer

Combiner classno

Fully qualified name of Java class to be used as combiner of the job. Definition of the class is typically found in the job JAR file.

Extends/implements
New APIorg.apache.hadoop.mapreduce.Reducer
Old APIorg.apache.hadoop.mapred.Reducer

Job configuration
ParameterNew APImapreduce.combine.class
Old APImapred.combiner.class
MethodNew APIJob.setCombinerClass(Class)
Old APIJobConf.setCombinerClass(Class)

Fully qualified class name, e.g. com.acme.MyReduce | No combiner (default)
Partitioner classno

Fully qualified name of Java class to be used as partitioner of the job. Definition of the class is typically found in the job JAR file.

Extends/implements
New APIorg.apache.hadoop.mapreduce.Partitioner
Old APIorg.apache.hadoop.mapred.Partitioner

Job configuration
ParameterNew APImapreduce.partitioner.class
Old APImapred.partitioner.class
MethodNew APIJob.setPartitionerClass(Class)
Old APIJobConf.setPartitionerClass(Class)

Fully qualified class name, e.g. com.acme.MyPartitioner

Default
New APIorg.apache.hadoop.mapreduce.lib.partition.HashPartitioner
Old APIorg.apache.hadoop.mapred.lib.HashPartitioner

Reducer classno

Fully qualified name of Java class to be used as reducer of the job. Definition of the class is typically found in the job JAR file.

Extends/implements
New APIorg.apache.hadoop.mapreduce.Reducer
Old APIorg.apache.hadoop.mapred.Reducer

Job configuration
ParameterNew APImapreduce.reduce.class
Old APImapred.reducer.class
MethodNew APIJob.setReducerClass(Class)
Old APIJobConf.setReducerClass(Class)

Fully qualified class name, e.g. com.acme.MyReduce

Default
New APIorg.apache.hadoop.mapreduce.Reducer
Old APIorg.apache.hadoop.mapred.lib.IdentityReducer

Mapper output key classno

Fully qualified name of Java class whose instances are the keys of mapper output records. Has to be specified only if the mapper output key class is different than the final output value class.

Job configuration
Parametermapred.mapoutput.key.class
MethodNew APIJob.setMapOutputKeyClass(Class)
Old APIJobConf.setMapOutputKeyClass(Class)

Fully qualified class name, e.g. org.apache.hadoop.io.Text | Default is the value of the Output key class attribute
Mapper output value classno

Fully qualified name of Java class whose instances are the values of mapper output records. Has to be specified only if the mapper output value class is different than the final output value class.

Job configuration
Parametermapred.mapoutput.value.class
MethodNew APIJob.setMapOutputValueClass(Class)
Old APIJobConf.setMapOutputValueClass(Class)

Fully qualified class name, e.g. org.apache.hadoop.io.Text | Default is the value of the Output value class attribute
Grouping comparatorno

Fully qualified name of Java class implementing comparator that decides which keys are grouped together for a single call to reduce method of the reducer. The class has to implement the org.apache.hadoop.io.RawComparator interface (or extend its base implementation org.apache.hadoop.io.WritableComparator).

Job configuration
Parametermapred.output.value.groupfn.class
MethodNew APIJob.setGroupingComparatorClass(Class)
Old APIJobConf.setOutputValueGroupingComparator(Class)

Fully qualified class name, e.g. com.acme.MyGroupingComp | Default class is derived in these steps: 1) take the class name value of the Sorting comparator attribute, if specified, otherwise 2) take implementation of org.apache.hadoop.io.WritableComparable registered as comparator for the Mapper output key class, if registered, otherwise 3) take the generic implementation, i.e. org.apache.hadoop.io.WritableComparator.
Sorting comparatorno

Fully qualified name of Java class implementing comparator that controls how the keys are sorted before they are passed to the reducer. The class has to implement the org.apache.hadoop.io.RawComparator interface (or extend its base implementation org.apache.hadoop.io.WritableComparator).

Job configuration
Parametermapred.output.key.comparator.class
MethodNew APIJob.setSortComparatorClass(Class)
Old APIJobConf.setOutputKeyComparatorClass(Class)

Fully qualified class name, e.g. com.acme.MySorter | Default class is the implementation of org.apache.hadoop.io.WritableComparable registered as comparator for the Mapper output key class, if registered, otherwise generic implementation org.apache.hadoop.io.WritableComparator is used.
Output key classyes

Fully qualified name of Java class whose instances are keys of output records of the job (output of the reducer, in other words).

Job configuration
Parametermapred.output.key.class
MethodNew APIJob.setOutputKeyClass(Class)
Old APIJobConf.setOutputKeyClass(Class)

Fully qualified class name, e.g. org.apache.hadoop.io.Text | org.apache.hadoop.io.LongWritable (default)
Output value classyes

Fully qualified name of Java class whose instances are values of output records of the job (output of the reducer, in other words).

Job configuration
Parametermapred.output.value.class
MethodNew APIJob.setOutputValueClass(Class)
Old APIJobConf.setOutputValueClass(Class)

Fully qualified class name, e.g. org.apache.hadoop.io.IntWritable | org.apache.hadoop.io.Text (default)
Input formatno

Fully qualified name of Java class that is to be used as input format of the job. This class implements parsing of input files and produces key-value pairs which will serve as input of the mapper.

Extends/implements
New APIorg.apache.hadoop.mapreduce.InputFormat
Old APIorg.apache.hadoop.mapred.InputFormat

Job configuration
ParameterNew APImapreduce.inputformat.class
Old APImapred.input.format.class
MethodNew APIJob.setInputFormatClass(Class)
Old APIJobConf.setInputFormat(Class)

Fully qualified class name

Default
New APIorg.apache.hadoop.mapreduce.lib.input.TextInputFormat
Old APIorg.apache.hadoop.mapred.TextInputFormat

Output formatno

Fully qualified name of Java class that is to be used as output format of the job. This class implementation takes key-value pairs produced by the reducer and writes them into output file.

Extends/implements
New APIorg.apache.hadoop.mapreduce.OutputFormat
Old APIorg.apache.hadoop.mapred.OutputFormat

Job configuration
ParameterNew APImapreduce.outputformat.class
Old APImapred.output.format.class
MethodNew APIJob.setOutputFormatClass(Class)
Old APIJobConf.setOutputFormat(Class)

Fully qualified class name, e.g. org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat in which case, output files can be read using the HadoopReader component.

Default
New APIorg.apache.hadoop.mapreduce.lib.input.TextOutputFormat
Old APIorg.apache.hadoop.mapred.TextOutputFormat

Advanced
Number of mappersno Number of mapper tasks that should be run by Hadoop to execute the job. This is only a hint, the actual number of spawned map tasks depends on input format class implementation. Integer grater than zero
Number of reducersno Number of required reducer tasks to be run by Hadoop to execute the job. It is legal to specify zero number of reducers in which case no reducer is run and output of mappers goes directly to the Output directory. Integer grater or equal to zero
Execute job as daemonno

By default, this is false and the ExecuteMapReduce component executes MapReduce jobs synchronously, i.e. it starts the job and waits until the job finishes, then it starts another job defined by next input token (or finishes if there are no more jobs to run).

If set to true, jobs are executed asynchronously, i.e. the component just starts the job and, instead of waiting, it immediately runs another job defined by next input token (or finishes if there are no more jobs to run). This also means that job runs are not monitored (no job run status is printed to graph run log).

false (default) | true
Stop processing on failno By default, any failed MapReduce job causes the component to stop executing other jobs and information about skipped tokens are sent to the error output port. This behavior can be turned off by this attribute. true (default) | false
Additional job settingsno

Other properties of the job that needs to be set can be specified here as key-value pairs. Key is Hadoop specific name of the property (must be valid for used version of Hadoop) and value is new value of the named property. Component attributes values have higher priority than values of corresponding properties specified here.

Value of this field has to be in form of Java properties files.

For each executed job, overview of all job settings (job.xml file) can be viewed on JobTracker HTML status page (by default running on port 50030).

 
[Note]Note

All of the component’s attributes described above can be also configured using data from input tokens. The Input mapping CTL transformation defines mapping from input token data fields to MapReduce job run configuration.

[Tip]Tip

When the ExecutemapReduce component creates job configuration, information about setting each parameter is printed with DEBUG log level into graph run log. Moreover, complete final job configuration XML is printed with TRACE log level.

Details

Output and error mappings

The ExecuteMapReduce component runs a Hadoop MapReduce job implemented using specified classes in a provided .jar file. The component periodically queries the Hadoop cluster for a job run status and prints this information to the graph log.

The MapReduce job classes can be implemented using both new and old Hadoop MapReduce job API. Implementation using the new API means that job classes extend adequate classes from the org.apache.hadoop.mapreduce package, whereas job classes using the old API implement appropriate interfaces from the org.apache.hadoop.mapred package. By default, the ExecuteMapReduce component expects the new job API. If your job is implemented with the old API, you have to explicitly set the Job implementation API version attribute (see below).

As a typical Job Control component, ExecuteMapReduce can have a single input port and two output ports attached. The component reads an input token, executes a MapReduce job based on incoming data values, waits for the job to finish, and sends the results of a successful job to the first output port and the results of a failed job to second output port (error port). If the job run is successful, the component continues processing the next input tokens. Otherwise, the component stops executing other jobs and, from then on, all incoming tokens are ignored and information about ignored tokens are sent to the error output port. This behavior can be changed via the attribute Stop processing on fail.

In the case that no input port is attached, only one MapReduce job is executed with default settings specified in the component's attributes. Both output ports are optional.

For a MapReduce job execution, it's necessary to specify at least the Hadoop connection, the location of a .jar file with classes implementing the MapReduce job, the input file and the output directory located on HDFS determined by the selected Hadoop connection, and finally, the output key/value classes. These and other (optional) settings could be considered as default execution settings. However, these default execution settings can be dynamically changed individually for each job execution based on data from an incoming token. The Input mapping attribute is where this override is defined.

After the MapReduce job is finished, results can be mapped to output ports. Output mapping and error mapping attributes define how output tokens are populated. Information available in job results are comprised mainly of general runtime information and job counters information.

Output and error mappings

Both mappings are regular CTL transformations. Output mapping is used to populate the token passed to the first output port. The mapping is executed for successful MapReduce jobs. Error mapping is used if and only if the job finished unsuccessfully and the second output port is populated instead of the first one.

If output mapping or error mapping is empty, fields of RunStatus record are mapped to output by name.

Input data records are the same for both mappings. Two or three records are available:

  • The input token which triggered the job execution (not available for component usage without an input connector). This is helpful when you need to pass some fields from the input token to the output token. This record has Port 0 displayed in the Type column.

  • JobResults records provide information about the job execution.

    Field NameTypeDescription
    jobIDstringThe unique identification given to the job by JobTracker. This value might not be set if the job failed before it was started while contacting the JobTracker.
    startTimedate Start date and time of the job. This is measured locally by CloverETL and might be slightly different from the job start time measured by JobTracker. Always set.
    endTimedate End date and time of the job. This is measured locally by CloverETL and might be slightly different from the job end time measured by JobTracker. Always set.
    durationlongDuration of the job in milliseconds. This is the difference between endTime and startTime in milliseconds. May not be greater than the timeout value of the job if it is set. This value is always set.
    statestring

    The state of the job at the end of its execution.

    Possible field values are:

    • SUCCEEDED if the job was executed successfully,

    • FAILED if job execution failed,

    • TIMEOUT if job was killed because its execution time exceeded specified timeout.

    clusterErrMessagestringError message string as obtained from the JobTracker.
    errExceptionstring Textual representation of full stack trace of exception that has occurred on JobTracker or during communication with the JobTracker. This value is unset if no exception has occurred.
    lastMapReducePhasestring The last MapReduce job phase that was in progress when the job ended. The value is one of following strings: Setup, Map, Reduce or Cleanup. If wasJobSuccessful is true then the value is Cleanup. In the case of job failure, this value might be inaccurate if there is a long communication delay to the JobTracker. The actual value can always be obtained using the JobTracker administration site. This value is always set.
    lastMapReducePhaseProgressnumber The progress of last MapReduce phase that was executing when the job ended. The value is a floating point number inside interval from 0 to 1, inclusively. If wasJobSuccessful is true then value is 1. In the case of job failure, the value might be inaccurate especially if there is a considerable communication delay to the JobTracker. Always set.

  • Values of counters handled by the job.

    Field NameTypeDescription
    allCountersmap[string, long]Map with name/value pairs of all counters available for the job.
    *long All other fields are names of some predefined (default) counters automatically collected by Hadoop for every job. The list of counters might differ depending on the version of Hadoop being used.

See also

Common Properties of Components
Specific Attribute Types
Common Properties of Job Control
Job control Comparison