Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to check if cloudera api call succeeded

How to check if cloudera api call succeeded

Hi

 

How do I know if  CLUSTER.start().wait() ...API call ..succeeded ? What do you capture for error conditions ?

 

Very eager to receive replies.

 

Thanks

 

Srikrishna

 

 

1 REPLY 1
Highlighted

Re: How to check if cloudera api call succeeded

Rising Star

Hello @positivekarma,

 

Here is a similar API call:

 

http://blog.cloudera.com/blog/2012/09/automating-your-cluster-with-cloudera-manager-api/

 

CMD_TIMEOUT = 180 # format_hdfs takes a list of NameNodes
cmd = hdfs.format_hdfs('hdfs01-nn')[0]
if not cmd.wait(CMD_TIMEOUT).success:
  raise Exception("Failed to format HDFS")

cmd = hdfs.start()
if not cmd.wait(CMD_TIMEOUT).success:
  raise Exception("Failed to start HDFS")


Did you try this?

 

if not CLUSTER.start().wait().success:
  raise Exception("Failed to start the cluster")

 

Other useful documentations:

 

https://cloudera.github.io/cm_api/docs/debugging-tips/
https://cloudera.github.io/cm_api/apidocs/v14/el_ns0_command.html

 

Gabor