What are the different ways to check if the mapreduce program ran successfully

431 Views Asked by At

If we need to automate a mapreduce program or run from a script, what are the different ways to check if the mapreduce program ran successfully? One way is to find is if _SUCCESS file is created in the output directory. Does the command "hadoop jar program.jar hdfs:/input.txt hdfs:/output" return 0 or 1 based on success or failure ?

1

There are 1 best solutions below

0
On BEST ANSWER

Just like any other command in Linux, you can check the exit status of a hadoop jar command using the built in variable $?.

You can use: echo $?
after executing the hadoop jar command to check its status.

The exit status value varies from 0 to 255. An exit status of zero implies that the command executed successfully while a non-zero value indicates that the command failed.

Edit: To see how to achieve automation or to run from a script, refer Hadoop job fails when invoked by cron.