Search code examples
apache-sparkhadoophadoop-yarnamazon-emr

How to kill an EMR task programatically


I want to programtically kill an EMR streaming task. If I kill it from EMR UI or boto client, it disappears in EMR, but it is still active in the Hadoop cluster (see this article). Only if I go through the Hadoop resource manager and kill it from there, the job is terminated. How can do the same programatically?


Solution

  • As @maxime-g said, the only way to kill a yarn application is to run the following command: yarn application -kill application_id. But it is possible to run an EMR which runs a script on the master node, and that script should include this command, and possible take an argument.