1

In my Azure Batch account, I run many jobs simultaneously. How can I get all tasks across all jobs?

Zach Esposito
  • 707
  • 9
  • 17

1 Answers1

1

Use BatchClient.JobOperations's ListJobs() and ListTasks():

using Microsoft.Azure.Batch;
using Microsoft.Azure.Batch.Auth;
/*...*/

var BatchClient = BatchClient.Open(new BatchSharedKeyCredentials(
  "<your-batch-endpoint>", 
  "<your-batch-account-name>", 
  "<your-shared-key>"));
var jobs = BatchClient.JobOperations.ListJobs();
var tasks = jobs.SelectMany(job => BatchClient.JobOperations.ListTasks(job.Id));
Zach Esposito
  • 707
  • 9
  • 17
  • In general, this is not best practice. You will want to design your queries to be efficient across the job and task space you are interested in. Please consult this doc: https://learn.microsoft.com/azure/batch/batch-efficient-list-queries – fpark Sep 10 '19 at 16:05