Job Executor
The Job Executor step allows you to execute a Pentaho Data Integration (PDI) job. It is similar to the Transformation Executor step, but works with jobs. By default, the specified job will be executed once for each input row. You can use the input row to set parameters and variables. The executor step then passes this row to the job in the form of a result row.
You can also pass a group of records based on the value in a field, such that when the value changes, the specified job is executed. In these cases, the first row in the group of rows is used to set parameters or variables in the job.
You can also launch multiple copies of this step to assist in parallel job processing.
This step does not abort when the calling job errors out. To control the flow or to abort the job incase of errors, please specify the fields and a target step in the Execution results tab to log the number of errors.
Samples
The following sample transformation and job, which demonstrate the capabilities of this step, are available in the distribution package in the
design-tools/data-integration/samples/transformations/job-executor
folder.
-
test-trans.ktr: Passes three rows ('one,' 'two,' 'three') to a job that is then executed three times. It sets a parameter to three different values. You can preview the Results, Result files, and Result rows steps to view the output.
-
test-job.kjb: Displays a message box with the value and set of the result files.
General
Enter the following information in the transformation step fields.
Option | Description |
---|---|
Step Name | Specifies the unique name of the transformation on the canvas. A transformation can be placed on the canvas several times; however, it represents the same transformation. The Step Name is set to 'Job Executor' by default. |
Job |
Specify your job to execute by entering its path or clicking Browse. If you select a job that has the same root path as the current job, the variable ${Internal.Entry.Current.Directory} will automatically be inserted in place of the common root path. For example, if the current job's path is /home/admin/transformation.kjb and you select a job in the folder /home/admin/path/sub.kjb than the path will automatically be converted to ${Internal.Entry.Current.Directory}/path/sub.kjb. If you are working with a repository, specify the name of the job. If you are not working with a repository, specify the XML file name of the job. Jobs previously specified by reference are automatically converted to be specified by the job name within the Pentaho Repository. |
Options
The Job Executor step features several tabs with fields for setting parameters and defining results. Each tab is described below.
Parameters Tab
This tab allows you to define or pass variables and/or parameters to the job. If multiple rows are passed to the job, the first row can be used to set the parameters or variables.
Option | Description |
---|---|
Variable/Parameter name | Specify the name of the variable or parameter. |
Field to use | Specify which field to set the particular parameter or variable value. If you specify an input field to use, the static input value is not used. |
Static input value | Instead of a field, specify a static value to use. |
Inherit all variables from transformation | When this check box is selected, all the variables defined in the parent transformation are passed to the child transformation. |
Get Parameters | Click this button to insert all the defined parameters of the specified transformation. The description of the parameter is inserted into the static input value field. |
Execution Results Tab
You can define the result fields for the job and to which step in the transformation to send them. If you do not need a certain result, leave a blank input field.
Option | Description | Default Value |
---|---|---|
The target step for the execution results |
Use the drop-down menu to select a step in the transformation as the target step to receive the results from the job. |
N/A |
Execution time (ms) | Specify the field name for the job execution time. | ExecutionTime |
Execution result | Specify the field name for the job execution result. | ExecutionResult |
Number of errors | Specify the field name for the number of errors during the execution of the job. | ExecutionNrErrors |
Number of rows read | Specify the field name for the total number of rows read during the execution of the job. | ExecutionLinesRead |
Number of rows written | Specify the field name for the total number of rows written during the execution of the job. | ExecutionLinesWritten |
Number of rows input | Specify the field name for the total number of input rows during the execution of the job. | ExecutionLinesInput |
Number of rows output | Specify the field name for the total number of output rows during the execution of the job. | ExecutionLinesOutput |
Number of rows rejected | Specify the field name for the total number of rows rejected during the execution of the job. | ExecutionLinesRejected |
Number of rows updated | Specify the field name for the total number of rows updated during the execution of the job. | ExecutionLinesUpdated |
Number of rows deleted | Specify the field name for the total number of rows deleted during the execution of the job. | ExecutionLinesDeleted |
Number of files retrieved | Specify the field name for the total number of files retrieved during the execution of the job. | ExecutionFilesRetrieved |
Exit status | Specify the field name for the exit status of the execution of the job. | ExecutionExitStatus |
Execution logging text | Specify the field name for the logging text from the execution of the job. | ExecutionLogText |
Log channel ID | Specify the field name for the log channel ID used during the execution of the job. | ExecutionLogChannelID |
Row Grouping Tab
Specify how to group the result rows by one of the following methods:
- Specific number of rows.
- Specific field.
- Specified duration of time.
You can use the result rows in a transformation or job entry, or you can get the records themselves by using the Get rows from result step in a transformation.
To access the Field to group rows on or Duration time when collecting rows options, delete the default value in the Number of rows to send to transformation option.
Option | Description |
---|---|
Number of rows to send to transformation | Specify a number. After every 'X' number of rows, the job will be executed and these 'X' rows will be passed to the transformation. |
Field to group rows on | Specify a field for grouping rows. Rows will be collected in a group as long as the field value stays the same. If the value changes, the job will be executed and the accumulated rows will be passed to the transformation. |
Duration time when collecting rows | Specify a time in milliseconds. This value is the amount of time the step will spend collecting rows prior to the execution of the job. |
Result Rows Tab
In this tab, you can specify the destination of the result rows from the job execution as well as the layout of the expected result rows.
This step will verify that the data type of the result row fields are identical to what is specified. If there is a difference, an error message will display.
Option | Description |
---|---|
Target step for result rows | Use the drop-down menu to select a step in the transformation as the target step. |
Field name | Specify the name of the field. |
Data type |
Use the drop-down menu to specify the data type of the field, such as number, date, or string. |
Length | If applicable, specify the length of the field. |
Precision | If applicable, specify the precision to use. |
Result Files Tab
In this tab, specify the destination of the result files.
Option | Description |
---|---|
Target step for result files information | Use the drop-down menu to select a step in the transformation as the target step. |
Result file name field | Specify the name of the field for the result files. |