All Products
Search
Document Center

listInstances

Last Updated: May 11, 2018

Method description

Obtains status details of all instances under a task based on the job ID and task name.

Parameter description

Parameter Type Required Description
jobId String Yes Job ID
taskName String Yes Name of a task
marker String No Start resource ID of the current page. Default value: Null string
maxItemCount int No Maximum number of returned items. The maximum value is 200. The default value is also 200

Response description

  • If the call succeeds, a ListInstancesResponse instance is returned. You can use the getInstanceList() method of this instance to obtain the List object.

  • If a failure occurs, a ClientException is thrown.

Sample code 1

  1. try{
  2. ListInstancesResponse response = client.listInstances("job-0101010299123","Find");
  3. //Succeeded
  4. List<Instance> list = response.getItems();
  5. //Marker of the next page. This parameter must be specified when you query the next page.
  6. String nextMarker = response.getNextMarker();
  7. }catch(ClientException e){
  8. e.printStackTrace();
  9. // Failed
  10. }

Sample code 2

  1. String marker = ""; //Next marker returned by the previous listJobs. This parameter is not specified upon the first query.
  2. int maxItemCount = 200; //The maximum value is 200. The default value is also 200.
  3. try{
  4. ListInstancesResponse response = client.listInstances("job-0101010299123","Find",marker,maxItemCount);
  5. //Succeeded
  6. List<Instance> list = response.getItems();
  7. //Marker of the next page. This parameter must be specified when you query the next page.
  8. String nextMarker = response.getNextMarker();
  9. }catch(ClientException e){
  10. e.printStackTrace();
  11. // Failed
  12. }

Attributes of Instance

Attribute Type Description
instanceId int Instance ID
state String Task state, which can be Waiting, Running, Failed, Finished, or Stopped
startTime Date Start time of the task. If the task is still in Waiting state, the start time is null
endTime Date End time of the task. If the task is not finished yet, the end time is null
retryCount int Number of retries
progress int Progress
stdoutRedirectPath String OSS directory to which standard output is redirected
stderrRedirectPath String OSS directory to which a standard error is redirected
result Result Result

Attributes of Result

Attribute Type Description
exitCode int Exit code of the program
errorCode String Error code
errorMessage String Error message
detail String Detailed information