In Hadoop YARN, the YARN containers exit when a SIGTERM signal is caught. So, how to detect when the YARN container is about to end and run some custom code. How do I inject it into the YARN framework?
I am looking for a solution especially for Spark on YARN but also a common solution applicable for other services that use YARN (Hive on Tez,MR)