获取实例列表
更新时间:
list_instances
参数说明:
| 属性 | 类型 | 描述 |
|---|---|---|
| job | str | 作业标识符 |
| task_name | str | 任务名称 |
| next_marker | str | 下一页起始资源标识符, 最后一页该值为空 |
| max_item_count | int | 实际返回最大资源数量,默认值50,最大值100 |
返回值说明:
list_instances方法返回一个
ListResponse对象。请参阅Instance类的描述,了解Instance对象的属性。
| 属性 | 类型 | 描述 |
|---|---|---|
| NextMarker | str | 下一页起始资源标识符, 最后一页该值为空。 |
| Items | list | Instance类型的列表 |
e.g.
try:# Get a Client object.client = Client(......job = "job-xxx"task_name = "echo_task"marker = ""max_item = 100round = 0while marker or round == 0:response = client.list_instances(job, task_name, marker, max_item)marker = response.NextMarkerfor instance in response.Items:print (instance.InstanceId, instance.State)round += 1except ClientError, e:print(e)
该文章对您有帮助吗?