Azure for AWS professionals - Batch Services - Azure - 4 Creating Tasks in a Batch Job

@20aman    Jul 05, 2019

Note that this post is a part of the series. You can view all posts in this series here: Azure for AWS professionals - Index

So far we have seen that to consume Azure Batch service we need a Batch account. Within this Batch account, we create a Pool. Next, we create a Job that runs on this Pool. Finally, every Job has multiple Tasks that are actually executed within the Job (and on the Pool)

In this post, we will create on such Task in a Job.

To create a Task, you begin by navigating to your Batch account (if not there already). Next click on the Jobs option under the Features category. Find your job and click on the same.

Navigating to Jobs

Within the job, find the Tasks menu and click on that. You will see "+Add" option here to add a new Task.

Tasks section

Next, a wizard will open up to add a new Task. Here primarily you provide a task Id, display name and Command line. Note, that this command line is where you specify what to run.

A simple command line may look like below. This displays the Batch environment variable and then waits for 180 seconds. This is used in the screenshots and later output.

cmd /c "set AZ_BATCH & timeout /t 180 > NUL"

A more complex command line, to execute an app package may look like:

cmd /c %AZ_BATCH_APP_PACKAGE_app01#1.0%\\myapp.exe

Add Task wizard

You can configure more settings like environment settings, task dependencies, and Application packages etc. Hit Submit when ready to create the Task.

More settings

To check the output of the task execution we will check the output stream. Navigate to your task. And then under the "Task Files" section click on the "Files on node" option. Here you will find the "stdout.txt" file. Click on this file to view the output.

Checking the output

The output stream (for the simple command line from above) will look like below. You can download this for offline usage if you require it.

Checking the Task output stream

This concludes a brief overview of how to consume Azure Batch service.

For more information check this link: Azure Batch service

Comments powered by Disqus