I want to create a cron to kill a yarn application (Spark) by it application name. But i found thant yarn application -kill needs an application ID. Is there a solution to kill it by application name, or to get the application ID using the application name.
Thank you
The output of the 'yarn application -list' contains the following information of yarn applications:
You can list the applications and awk by the required parameter. For ex: to list the applications by 'Application-Name'
yarn application -list | awk '$2 == "APPLICATION_NAME" { print $1 }' > applications_list.txt
Then you can iterate through the file and kill the applications as below:
while read p; do
echo $p
yarn application -kill $p
done <applications_list.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With