Quantcast
Channel: Diethard Steiner on Business Intelligence
Viewing all articles
Browse latest Browse all 85

Pentaho Kettle (PDI): Get Pan and Kitchen Exit Code

$
0
0
Various monitoring applications require the exit code/status of a process as an input.

A simple example (test1.sh):

#!/bin/bash
echo "Hi"
exit $?

Let’s run it:
$ ./test1.sh
Let’s check the exit status (of the last command) which can be accessed via $?:
$ echo $?
0

Let’s take a look at how we can get the exit status from Pan and Kitchen:

For demonstration purposes we create a very simple dummy transformation which just outputs some data to the log:
Now create a shell file:
#!/bin/bash
/opt/pentaho/pdi/pdi-ce-4.4.0-stable/pan.sh -file='/home/dsteiner/Dropbox/pentaho/Examples/PDI/exit_code/tr_dummy.ktr' -Level=Basic > /home/dsteiner/Dropbox/pentaho/Examples/PDI/exit_code/err.log
echo $?

Note the echo $? in the last line which will return the exit status. This is for demonstration purposes here only. Normally you would use exit $? instead.

On Windows use instead:
echo %ERRORLEVEL%

Now lets run the shell script:
The exit status tells us that the transformation was executed successfully.

Next we will introduce an error into the transformation. I just add a formula step with a wrong formula:
We run the shell script again and this time we get a return code other than 0:
Any return code other than 0 means it is an error.

Please find below an overview of all the return codes (src1, src2):

Error Code
Description
0
The job ran without a problem
1
Errors occurred during processing
2
An unexpected error occurred during loading / running of the job / transformation, an error in the XML format, reading the file, problems with the repository connection, ...
3
unable to connect to a database, open a file or other initialization error.
7
The job / transformation couldn't be loaded from XML or the Repository
8
Error loading job entries or steps or plugins (error in loading one of the plugins mostly).one of the plugins in the plugins/ folder is not written correctly or is incompatible. You should never see this anymore though. If you do it's going to be an installation problem with Kettle.
9
Command line usage printing


Viewing all articles
Browse latest Browse all 85

Trending Articles