Exercise - Monitor and visualize your batch job in Batch Explorer

Completed

The Batch Explorer lets you view the status of jobs in the Azure Batch service.

As the solution architect, you need a way to visualize the progress of the large numbers of nodes and tasks being used to perform the parallel processing of water purification images.

Here, you execute a job in Azure Batch and then use the Batch Explorer to view its progress.

Important

The exercises in this module are optional. To complete the exercises, you need your own Azure subscription.

Use the Batch Explorer to analyze a job

Using Azure Batch Explorer, you can see the Batch accounts you have in your account in the left-hand sidebar, and the status of pools, nodes, jobs, and tasks in the right.

In certain scenarios, you might have hundreds or thousands of tasks running in various states of progress on hundreds or thousands of nodes. It's crucial that you can visualize this information quickly, and that you're able to drill down into the detail of any problems or areas of particular interest.

  1. Sign into the Azure portal.

  2. Open the Cloud Shell by selecting the Cloud Shell icon (>_) in the top menu.

  3. Run the following command in the Cloud Shell to create a new Azure Batch job, using the Batch account and pool you created in the previous exercise:

    az batch job create \
     --id explorerjob \
     --pool-id mypool
    
  4. In the Azure portal, open your Batch account resource. You can find it in your resource group's Overview section.

  5. Go to the Jobs section under Features.

  6. Select the active job.

    A panel opens up showing the job status. This panel is empty because you didn't create any tasks, and nothing is running.

  7. Run the following command in the Cloud Shell to create new Azure Batch tasks, using the Batch account and pool you created in the previous exercise:

    for i in {1..100}
    do
       az batch task create \
        --task-id mytask$i \
        --job-id explorerjob \
        --command-line "/bin/bash -c 'printenv; sleep 5s'"
    done
    

    This job consists of more tasks, each of which outputs all environment variables, then waits five seconds. Batch Explorer is powerful for monitoring more numerous and longer-running tasks.

  8. Go back to Batch Explorer. Notice, in the top-right corner, tasks being queued, an indication of progress, and the number of tasks that succeeded or failed.

  9. Select the Refresh button to the right of the Filter by task ID box. As tasks complete, the task details, including the exit code, appear here.