All Products
Search
Document Center

Batch Compute:listJobs

Last Updated:May 11, 2018

Method description

Obtains all jobs of the current user.

Parameter description

Parameter Type Required Description
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 ListJobsResponse instance is returned. You can use the getJobList() method of this instance to obtain the List object.

  • If failure occurs, a ClientException is thrown.

Sample code

  1. try{
  2. ListJobsResponse response = client.listJobs();
  3. //Succeeded
  4. List<Job> 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 = 100; //The maximum value is 100. The default value is 50.
  3. try{
  4. ListJobsResponse response = client.listJobs(marker, maxItemCount);
  5. //Succeeded
  6. List<Jobs> 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. }

Sample code 3

  1. String marker = ""; //Next marker returned by the previous listJobs. This parameter is not specified upon the first query.
  2. int maxItemCount = 100; //The maximum value is 100. The default value is 50.
  3. try{
  4. List<Jobs> list = new ArrayList<Jobs>();
  5. do{
  6. ListJobsResponse response = client.listJobs(marker, maxItemCount);
  7. //Succeeded
  8. list.addAll(response.getItems());
  9. //Marker of the next page. This parameter must be specified when you query the next page.
  10. marker = response.getNextMarker();
  11. }while(marker!=null && !marker.equals(""))
  12. for (Job job: list){
  13. System.out.println(job.getId()+" "+job.getNae());
  14. }
  15. }catch(ClientException e){
  16. e.printStackTrace();
  17. // Failed
  18. }