Baidu AI Cloud
中国站

百度智能云

MapReduce

Instance

Query Instance Lists

The following code is used to query the instance of specified cluster and instance group:

try:
    response = bmr_client.list_instances(cluster_id, instance_group_id)
    for instance in response.instances:
        LOG.debug('list instances %s: %s' % (instance.id, instance))
except BceHttpClientError as e:
    if isinstance(e.last_error, BceServerError):
        LOG.error('list_instances failed. Response %s, code: %s, msg: %s'
                  % (e.last_error.status_code, e.last_error.code, e.last_error.message))
    else:
        LOG.error('list_instances failed. Unknown exception: %s' % e)
Previous
Install SDK Kit
Next
InstanceGroup