获取集群信息

接口

get_cluster

参数

参数 类型 是否必须 描述
cluster string 集群标识符

返回值

get_cluster方法将返回一个GetResponse 对象。

例子

Python 源码:

e.g.

  1. import time
  2. import batchcompute
  3. from batchcompute import CN_SHENZHEN as REGION
  4. from batchcompute import Client, ClientError
  5. ACCESS_KEY_ID = 'Your Access Key Id'
  6. ACCESS_KEY_SECRET = 'Your Access Key Secret'
  7. client = Client(REGION, ACCESS_KEY_ID, ACCESS_KEY_SECRET)
  8. def get_cluster():
  9. try:
  10. cluster_id = "cls-xxx"
  11. rsp = client.get_cluster(cluster_id)
  12. print (rsp.Name, rsp.State)
  13. except ClientError, e:
  14. print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())
  15. if __name__ == '__main__':
  16. get_cluster()

执行结果:

  1. (u'test-cluster', u'Active')