Search code examples
hadoopkilljobs

how to kill hadoop jobs


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


Solution

  • Depending on the version, do:

    version <2.3.0

    Kill a hadoop job:

    hadoop job -kill $jobId
    

    You can get a list of all jobId's doing:

    hadoop job -list
    

    version >=2.3.0

    Kill a hadoop job:

    yarn application -kill $ApplicationId
    

    You can get a list of all ApplicationId's doing:

    yarn application -list