how to kill hadoop jobs

前端 未结 6 1954
情话喂你
情话喂你 2020-12-22 23:49

I want to kill all my hadoop jobs automatically when my code encounters an unhandled exception. I am wondering what is the best practice to do it?

Thanks

6条回答
  •  Happy的楠姐
    2020-12-23 00:28

    Use below command to kill all jobs running on yarn.

    For accepted jobs use below command.

    for x in $(yarn application -list -appStates ACCEPTED | awk 'NR > 2 { print $1 }'); do yarn application -kill $x; done

    For running, jobs use the below command.

    for x in $(yarn application -list -appStates RUNNING | awk 'NR > 2 { print $1 }'); do yarn application -kill $x; done

提交回复
热议问题