General Info
Visual Studio Requirements
You will need VS 2015 or later to compile the projects. If you don't have it, you can download the community edition here for free.
Building the Samples
Download the samples and open the solution file for each one using Visual Studio. Right click on the solution and select "Rebuild". Visual Studio will analyze the dependencies and download the dependent binaries from nuget.org.
Preallocating Pools and Compute Nodes
Samples outside of ArticleProjects require a pre-created pool with deployed compute nodes. If your tasks are not being scheduled, it is likely that there are no nodes to host the tasks; some of the samples detect this and will add 3 small nodes to the specified pool. You can use the Azure Batch Explorer to monitor this situation, as well as create the pool and resize it to have some number of nodes. You can then specify this pool's id in some of the samples so you don't have to wait for the nodes to become available.
Configuring Credentials
In order the run the samples, they must be configured with Azure Batch and Azure Storage credentials. The credentials for each sample are gathered from the AccountSettings configuration located here. The settings can be set via the Visual Studio settings manager. Once you have configured your account credentials, you can run any of the samples and they will make use of the credentials provided in the AccountSettings configuration.
Sample Descriptions
AccountManagement
This sample demonstrates the use of the Microsoft.Azure.Management.Batch library to perform basic operations related to Batch accounts. View the companion article for more information.
ArticleProjects
These projects contain the sample code backing various articles in Batch documentation. Most of the samples in ArticleProjects are intended not as end-to-end API usage samples, but rather to demonstrate a specific feature of the Batch service.
BatchExplorer
Note: Batch Labs is a cross-platform client tool for browsing Azure Batch resources. Batch Labs is supported by Microsoft and is the preferred client tool to use with Azure Batch. Batch Explorer will continue to exist in this repository only as a sample and will not be updated to expose the latest features of Azure Batch. We will not be accepting new feature contributions.
The Azure Batch Explorer is a GUI application that can be useful in viewing, managing, and debugging entities within an Azure Batch account. View this blog post for more details.
BatchMetrics
This sample demonstrates efficient list queries and provides a utility library for job progress monitoring.
GettingStarted
This set of samples is intended to be the starting point for learning the concepts behind Azure Batch and its API. It covers basic features of the service, including jobs, pools, tasks, and more.
TextSearch
This map-reduce style sample uses Azure Batch to perform parallel text processing on an input file by splitting it up into multiple sub-files and performing regular expression matching on each sub-file. A Job Manager task is used to orchestrate the mapper and reducer tasks with the results rolled-up into a final report. See the readme in the source directory for more information.
TopNWords
This sample demonstrates how to process a set of input blobs in parallel on multiple compute nodes. In this case, there is only one blob but the code can be expanded to load more blobs and bind them to individual tasks. The task writes a list of length N to stdout that contains the words in the blob with the highest occurrence count. A run-once job is created followed by the creation of multiple tasks with each task processing its blob. The job code then waits for each of the tasks to complete and prints out the list generated for each input blob.