/// <summary> /// Runs the reducer task. /// </summary> public async Task RunAsync() { //Set up the Batch Service credentials used to authenticate with the Batch Service. BatchCredentials credentials = new BatchCredentials( this.configurationSettings.BatchAccountName, this.configurationSettings.BatchAccountKey); using (IBatchClient batchClient = BatchClient.Connect(this.configurationSettings.BatchServiceUrl, credentials)) { using (IWorkItemManager workItemManager = batchClient.OpenWorkItemManager()) { //Gather each Mapper tasks output and write it to standard out. for (int i = 0; i < this.configurationSettings.NumberOfMapperTasks; i++) { string mapperTaskName = Helpers.GetMapperTaskName(i); //Download the standard out from each mapper task. ITaskFile taskFile = await workItemManager.GetTaskFileAsync( this.workItemName, this.jobName, mapperTaskName, Microsoft.Azure.Batch.Constants.StandardOutFileName); string taskFileString = await taskFile.ReadAsStringAsync(); Console.WriteLine(taskFileString); Console.WriteLine(); } } } }