Short Description |
Ports |
Metadata |
ExecuteMapReduce Attributes |
Details |
See also |
ExecuteMapReduce runs specified MapReduce job on a Hadoop cluster.
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 | 0-1 | 0-2 |
Port type | Number | Required | Description | Metadata |
---|---|---|---|---|
Input | 0 | Input tokens with MapReduce job execution settings. | Any | |
Output | 0 | Execution information for successful jobs. | Any | |
1 | Execution information for unsuccessful jobs. | Any |
This component has metadata templates available. See details on Metadata Templates.
Attribute | Req | Description | Possible values | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basic | ||||||||||||||||||||||||||||
Hadoop connection | yes | Hadoop connection which defines both connection to HDFS server (NameNode) and connection to MapReduce server (JobTracker). | ||||||||||||||||||||||||||
Job name | no |
Arbitrary label of a job execution. Default value is the name of specified
MapReduce .jar file.
| Any string | |||||||||||||||||||||||||
URL of JAR file with job classes | yes |
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 mapping | no | Input mapping defines how data from incoming token overrides default execution settings. | CTL transformation | |||||||||||||||||||||||||
Output mapping | no | Output mapping maps results of successful MapReduce jobs to the first output port. See Output and error mappings. | CTL transformation | |||||||||||||||||||||||||
Error mapping | no | Error mapping maps results of unsuccessful jobs to the second output port. See Output and error mappings. | CTL transformation | |||||||||||||||||||||||||
Redirect error output | no |
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 files | yes |
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 directory | yes |
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 directory | no |
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 execution | no |
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 version | yes |
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 class | no |
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:
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).
|
Fully qualified class name, e.g.
| |||||||||||||||||||||||||
Combiner class | no |
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.
| Fully qualified class name, e.g. com.acme.MyReduce | No combiner (default) | |||||||||||||||||||||||||
Partitioner class | no |
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.
|
Fully qualified class name, e.g.
| |||||||||||||||||||||||||
Reducer class | no |
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.
|
Fully qualified class name, e.g.
| |||||||||||||||||||||||||
Mapper output key class | no |
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.
|
Fully qualified class name, e.g. org.apache.hadoop.io.Text |
Default is the value of the Output key class attribute
| |||||||||||||||||||||||||
Mapper output value class | no |
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.
|
Fully qualified class name, e.g. org.apache.hadoop.io.Text |
Default is the value of the Output value class attribute
| |||||||||||||||||||||||||
Grouping comparator | no |
Fully qualified name of Java class implementing comparator that
decides which keys are grouped together for a single call to
|
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 comparator | no |
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
|
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 class | yes |
Fully qualified name of Java class whose instances are keys of output records of the job (output of the reducer, in other words).
|
Fully qualified class name, e.g. org.apache.hadoop.io.Text |
org.apache.hadoop.io.LongWritable (default)
| |||||||||||||||||||||||||
Output value class | yes |
Fully qualified name of Java class whose instances are values of output records of the job (output of the reducer, in other words).
|
Fully qualified class name, e.g. org.apache.hadoop.io.IntWritable |
org.apache.hadoop.io.Text (default)
| |||||||||||||||||||||||||
Input format | no |
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.
|
Fully qualified class name
| |||||||||||||||||||||||||
Output format | no |
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.
|
Fully qualified class name, e.g.
| |||||||||||||||||||||||||
Advanced | ||||||||||||||||||||||||||||
Number of mappers | no | 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 reducers | no | 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 daemon | no |
By default, this is
If set to | false (default) | true | |||||||||||||||||||||||||
Stop processing on fail | no | 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 settings | no |
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 | |
---|---|
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 | |
---|---|
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. |
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.
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 Name | Type | Description |
---|---|---|
jobID | string | The 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. |
startTime | date | 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. |
endTime | date | 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. |
duration | long | Duration 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. |
state | string |
The state of the job at the end of its execution. Possible field values are:
|
clusterErrMessage | string | Error message string as obtained from the JobTracker. |
errException | string | 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. |
lastMapReducePhase | string |
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.
|
lastMapReducePhaseProgress | number |
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 Name | Type | Description |
---|---|---|
allCounters | map[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. |