I am using this Microsoft tutorial for a starting point for using Azure Batch pools, jobs, and containers.
I have altered their code for deleting pools and jobs slighty to
// Cleanup Batch Account Resources
// Clean up Job
await batchClient.JobOperations.DeleteJobAsync($"{BatchConstants.JobIdPrefix}-{Guid}");
// Clean up Pool
await batchClient.PoolOperations.DeletePoolAsync($"{BatchConstants.PoolIdPrefix}-{Guid}");
This works great when I run this code locally, but when it goes up to my development environment it runs into an issue when deleting the pool or job (usually the job). I get back the status code "ServiceUnavailable".
When I manually login to the Azure portal, I can see the container were deleted without issue (so I know the connection is able to be made and can successfully delete Azure objects), but notice the pool and job are still alive.
It does not appear that JobOperations
or PoolOperations
have a notion of retry policies, so is there any other way I can have it retry deleting pools and/or jobs a few more times if it gets back a ServiceUnavailable status? Or should I just try it in essentially a for loop that runs up to 5 (or so) times if it gets back a bad status code or continues with the rest of the program if a good status code comes back?
Thanks for the help.