How can we find out in Azure Portal that a VM in Batch Account has been preempted while a specific Job was running there?

Mojahedi, D. (Davood) 5 Reputation points
2024-01-02T16:17:22.37+00:00

We are using Azure Batch account ,we have created some spotVm pools there and using VMs from those pools.

I know when we are using SpotVMs it can be happened that Microsoft takes back the VM for a while and then again release that VM and tasks will be restarted after releasing VM.

Now my question is that How can I find out while a specific task was running in a VM, that VM was pre-empted or not? it means I want to know if I have a task name or Job name , Can I see state of the VM that task or job was running on, something like logs or history of status of VMs.

I know there is a menu in Azure Batch account "Metrics" ,we can see report of Pre-empted nodes there, but it is not the case I need, it's only a report and we cannot find specific task on it or specific VM in a specific time.

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
303 questions
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 23,496 Reputation points Microsoft Employee
    2024-01-04T23:39:24.51+00:00

    Hello, @Mojahedi, D. (Davood) ! I reached out to the Azure Batch team and their recommendation was to use the ComputeNodeInformation property as described below.

    How can I find out if a specific task was preempted or not while using Azure Batch?

    You are able to get the task and look at the ComputeNodeInformation property:

    https://learn.microsoft.com/en-us/rest/api/batchservice/task/get?view=rest-batchservice-2023-05-01

    This will allow you to find out which Batch compute node the task ran on. You can then query the VM for its current state (querying past state is not available). You would need to use a Batch monitoring solution to construct past state if that's required.


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image