- Learning Pentaho Data Integration 8 CE(Third Edition)
- María Carina Roldán
- 403字
- 2025-04-04 17:49:50
Getting familiar with the job design process
Now you will create a Job similar to the one you created at the beginning of the chapter, but with the addition of some extra tasks. The new version of the Job will create a folder with a name of your choice. If an error occurs, the fact will be reported to the PDI log.
Here are the instructions:
- Open the Job you created before and save it under a different name
- Double-click the Create folder entry and replace the name of the folder with ${Internal.Entry.Current.Directory}/${MY_FOLDER}
- From the Utility category of steps, drag to the canvas a Write To Log entry
We want to run this last entry only when the creation of the folder fails. We do it as follows:
- Create a new hop from the Create folder entry to this new entry. The hop will be green
- Click twice on the lock of this hop so it becomes red. Leave it in this color
- Double-click on the Write To Log entry and fill it as shown:

Configuring the Write To Log entry
- Close the window. Your Job looks like this:

Sample job
- Save the Job
For specifying the name of the new folder, you didn't type a fixed named but a Kettle user-defined variable named ${MY_FOLDER}. Let's run the Job so you can see how you set this variable:
- Click F9 to run the Job. In the Run Options window, select the tab named Variables.
- In the grid, you should see your variable. You should give it a value before proceeding. You do it by typing a name under the Value column, as shown next:

Setting variables while running a Job
- Run the Job. A folder with the name you just typed should have been created. If you look at the work area and the result window, you should see that the Create folder entry succeeded; this is marked visually with a green tick on the Create folder icon. This is the reason why the Write To Log entry didn't run.
- Run the Job again. As the new folder, type the same name as before. This time, you should see that Create folder failed; this is marked with a red tick on the Create folder icon. Because of this failure, the Write To Log entry runs and sends a message that you can see in the log.