Azure-Samples / azure-batch-samples

Azure Batch and HPC Code Samples
Other
261 stars 487 forks source link

Retrieve CloudTask statistics using ODATADetailLevel expandClause not working #256

Closed dedreira closed 5 years ago

dedreira commented 5 years ago

Hi, I'm trying to retrieve CloudTask statistics using this sentence:

IPagedEnumerable tasks = job.ListTasks(new ODATADetailLevel(selectClause: "id , stats", expandClause: "stats"));

Referring to this article: https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.batch.cloudtask.statistics?view=azure-dotnet

But when I iterate over the task collection while debugging I can see that Statistics property hasn't been populated.

bgklein commented 5 years ago

Could you try removing the spaces from around the ','? Because we feed the OData information straight into the rest call (without any parsing) this could cause the url to become invalid.

If this does not work @matthchr , could this be a regression in the .NET SDK?

dedreira commented 5 years ago

Hi, I've tried what you said, removing white spaces around , also tried to execute these sentences: //No white-spaces IPagedEnumerable tasks = job.ListTasks(new ODATADetailLevel(selectClause: "id,stats", expandClause: "stats"));

//No select clause IPagedEnumerable tasks = job.ListTasks(new ODATADetailLevel(expandClause: "stats"));

//Using asynchronous methods as seen in this example: //https://github.com/Azure-Samples/azure-batch-samples/blob/master/CSharp/ArticleProjects/EfficientListQueries/Program.cs ODATADetailLevel detail = new ODATADetailLevel(); detail.ExpandClause = "stats"; List taskList = new List(); taskList.AddRange(await batchClient.JobOperations.ListTasks(job.Id, detail).ToListAsync());

and the results are the same, Statistics property is null . . .

matthchr commented 5 years ago

How long are you waiting between your task being created and when you call list with stats?

I believe there is a delay for the stats to be aggregated - I'd have to double check the aggregation period but I thought it was something like 15m, so it would be expected to not get stats for the first 15m.

dedreira commented 5 years ago

The tasks I'm querying now for the stats were created two days ago :(

bgklein commented 5 years ago

@dedreira If you would be willing to share the batch account name and region we can check the logs to verify if the Batch Service is returning you any statistics and look into why this is happening.

dedreira commented 5 years ago

Hi again,

I was wondering.... maybe the task statistics are only available when the task is completed? It's not possible to view statistics for running tasks??

dedreira commented 5 years ago

That's it, statistics property for a Cloud Task is not available until task is Completed....