All Products
Search
Document Center

Batch Compute:listTasks

Last Updated:May 11, 2018

Method description

Obtains status details of all tasks under a job based on the job ID.

Parameter description

Parameter Type Required Description
jobId String Yes Job ID
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 ListTasksResponse instance is returned. You can use the getTaskList() method of this instance to obtain the List object.

  • If a failure occurs, a ClientException is thrown.

Sample code 1

  1. try{
  2. ListTasksResponse response = client.listTasks("job-0101010299123");
  3. //Succeeded
  4. List<Task> 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. ListTasksResponse response = client.listTasks("job-0101010299123",marker,maxItemCount);
  5. //Succeeded
  6. List<Task> 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 Task

Attribute Type Description
taskName String Name of a task
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
instanceMetrics Metrics Number of instances in various states