title: How to fail a spark application when there is an error
body: <p>I want to make my Spark application fail, while I encounter an error ( like my file line count is less than 10, it a logical error for my business logic) . I am doing a System.exit(20), but when I am checking status of the application in yarn (yarn application -status ) it shows succeeded, I want to see failed instead . I am automating things using shell script, but this behavior is an hindrance for me.</p>
  
  <p>Will you please help me , how can I grace fully fail my spark application , so that yarn application status will be failed .</p>
  
  <p>NOTE: I am running spark in yarn cluster mode </p>
  
  <p>Thanks,</p>