All Products
Search
Document Center

Batch Compute:list_instances

Last Updated:May 14, 2018

Parameter description

Attribute Type Description
job str Job ID
task_name str Task name
next_marker str Start resource ID on the next page. The value is null for the last page
max_item_count int Maximum number of actually returned resources. The default value is 50. The maximum value is 100

Response description

  • The list_instances method returns a ListResponse object.

  • For more information about attributes of the Instance object, see the description of the Instance class.

Attribute Type Description
NextMarker str Start resource ID on the next page. The value is null for the last page
Items list List of Instance classes

Example

  1. try:
  2. # Get a Client object.
  3. client = Client(...
  4. ...
  5. job = "job-xxx"
  6. task_name = "echo_task"
  7. marker = ""
  8. max_item = 100
  9. round = 0
  10. while marker or round == 0:
  11. response = client.list_instances(job, task_name, marker, max_item)
  12. marker = response.NextMarker
  13. for instance in response.Items:
  14. print (instance.InstanceId, instance.State)
  15. round += 1
  16. except ClientError, e:
  17. print(e)