You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Juanjo Marron <ju...@yahoo.com> on 2015/07/09 18:25:01 UTC

REST API operations completed

Hi all,

Is there a backend way to be notified when an Ambari operation (such as running a service check or restart) has finished?
Or is there a way to run a service check from the backend using REST API command, but it returns the result of the service check only after it completes? 

When using REST API command to run a service check, we are instantly given info regarding that service check, instead of receiving that info after it completes.

Other then constantly checking that request using a REST API command, is there a way to know when the Ambari operation has completed?

Thanks for your time



Re: REST API operations completed

Posted by Juanjo Marron <ju...@yahoo.com>.
Hi Alejandro,

Great Thanks!

That was actually our approach

Best regards, 

Juanjo Marron
 


     On Thursday, July 9, 2015 10:22 AM, Alejandro Fernandez <af...@hortonworks.com> wrote:
   

 You have to keep polling for the request id until it completes.
curl -X POST -u admin:admin -H 'X-Requested-By:1' http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests -d '{"RequestInfo":{"context":"YARN Service Check","command":"YARN_SERVICE_CHECK"},"Requests/resource_filters":[{"service_name":"YARN"}]}'
{  "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests/12",  "Requests" : {    "id" : 12,    "status" : "Accepted"  }}%

curl -X GET -u admin:admin -H 'X-Requested-By:1' http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests/12 | grep request_status    "request_status" : "COMPLETED",
Thanks,Alejandro
From: Juanjo Marron <ju...@yahoo.com>
Reply-To: Ambari User <us...@ambari.apache.org>, Juanjo Marron <ju...@yahoo.com>
Date: Thursday, July 9, 2015 at 9:25 AM
To: Ambari User <us...@ambari.apache.org>
Subject: REST API operations completed

Hi all,

Is there a backend way to be notified when an Ambari operation (such as running a service check or restart) has finished?
Or is there a way to run a service check from the backend using REST API command, but it returns the result of the service check only after it completes?

When using REST API command to run a service check, we are instantly given info regarding that service check, instead of receiving that info after it completes.

Other then constantly checking that request using a REST API command, is there a way to know when the Ambari operation has completed?

Thanks for your time




  

Re: REST API operations completed

Posted by Alejandro Fernandez <af...@hortonworks.com>.
You have to keep polling for the request id until it completes.

curl -X POST -u admin:admin -H 'X-Requested-By:1' http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests -d '{"RequestInfo":{"context":"YARN Service Check","command":"YARN_SERVICE_CHECK"},"Requests/resource_filters":[{"service_name":"YARN"}]}'

{
  "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests/12",
  "Requests" : {
    "id" : 12,
    "status" : "Accepted"
  }
}%


curl -X GET -u admin:admin -H 'X-Requested-By:1' http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests/12 | grep request_status
    "request_status" : "COMPLETED",

Thanks,
Alejandro

From: Juanjo Marron <ju...@yahoo.com>>
Reply-To: Ambari User <us...@ambari.apache.org>>, Juanjo Marron <ju...@yahoo.com>>
Date: Thursday, July 9, 2015 at 9:25 AM
To: Ambari User <us...@ambari.apache.org>>
Subject: REST API operations completed

Hi all,

Is there a backend way to be notified when an Ambari operation (such as running a service check or restart) has finished?
Or is there a way to run a service check from the backend using REST API command, but it returns the result of the service check only after it completes?

When using REST API command to run a service check, we are instantly given info regarding that service check, instead of receiving that info after it completes.

Other then constantly checking that request using a REST API command, is there a way to know when the Ambari operation has completed?

Thanks for your time