Tao Xiao
Tao Xiao

Reputation: 279

Can not kill a YARN application through REST api

I'm using Hadoop 2.5.0 (CDH 5.3.5).

Following this document, I tried to kill a running YARN application (whose application id is application_1438849897472_0011) through the following REST api:

curl -i -XPUT http://{rm-rest-host}:{rm-rest-port}/ws/v1/cluster/apps/application_1438849897472_0011/killed

But I got a status code of 404 and an exception message complaining about

org.apache.hadoop.yarn.webapp.WebAppException: /v1/cluster/apps/application_1438849897472_0011/killed: controller for v1 not found


So what is going wrong ?

Upvotes: 1

Views: 5452

Answers (2)

Bacon
Bacon

Reputation: 1844

Try the following:

curl -v -X PUT -d '{"state": "KILLED"}''http://{rm-rest-host}:{rm-rest-port}/ws/v1/cluster/apps/application_1438849897472_0011/state'

The documentation you linked states:

With the application state API, you can query the state of a submitted app as well kill a running app by modifying the state of a running app using a PUT request with the state set to "KILLED". To perform the PUT operation, authentication has to be setup for the RM web services. In addition, you must be authorized to kill the app. Currently you can only change the state to "KILLED"; an attempt to change the state to any other results in a 400 error response. Examples of the unauthorized and bad request errors are below. When you carry out a successful PUT, the iniital response may be a 202. You can confirm that the app is killed by repeating the PUT request until you get a 200, querying the state using the GET method or querying for app information and checking the state. [...]

Upvotes: -2

jbochi
jbochi

Reputation: 29634

The correct URI ends with /state, not /killed and you are missing the request body.

Try this:

curl -v -X PUT -H "Content-Type: application/json" -d '{"state": "KILLED"}' 'http://{rm-rest-host}:{rm-rest-port}/ws/v1/cluster/apps/{app-id}/state'

Upvotes: 4

Related Questions