簡體   English   中英

AddTaskAsync BatchErrorException:操作返回了無效的狀態碼“ BadRequest”

[英]AddTaskAsync BatchErrorException: Operation returned an invalid status code 'BadRequest'

我已經基於以下示例使用模板實現了Azure Batch示例:

https://github.com/Azure/azure-batch-samples/tree/master/CSharp/TextSearch

我的解決方案創建了一個作業管理器任務,該任務又為我的每個部門創建了多個子任務。 我在下面的代碼中調用batchClient.JobOperations.AddTaskAsync時收到“ BadRequest ”錯誤:

Console.WriteLine("Submitting {0} mapper tasks.", extracts.Count());

//The collection of tasks to add to the Batch Service.
List<CloudTask> tasksToAdd = new List<CloudTask>();

// Create Batch jobs
foreach (var extract in extracts)
{
// ToDo: Uncomment this
// extractService.SetStatus(extract.Id, WarehouseMasterConstants.eExtractStatus.Queuing);

string taskId = Helpers.GetSummarizeDivisionTaskId(extract.Id);
Console.WriteLine("Task Id: " + taskId);

string commandLine = string.Format("{0} {1}", SummarizeDivisionConstants.SummarizeDivisionTaskExecutable, extract.Id.ToString());
Console.WriteLine("Command Line: " + commandLine);
CloudTask unboundMapperTask = new CloudTask(taskId, commandLine);

//The set of files (exes, dlls and configuration files) required to run the mapper task.
IReadOnlyList<string> mapperTaskRequiredFiles = SummarizeDivisionConstants.RequiredExecutableFiles;

List<ResourceFile> mapperTaskResourceFiles = BatchHelpers.GetResourceFiles(containerSas, mapperTaskRequiredFiles);

unboundMapperTask.ResourceFiles = mapperTaskResourceFiles;

tasksToAdd.Add(unboundMapperTask);
}

//Submit the unbound task collection to the Batch Service.
//Use the AddTask method which takes a collection of CloudTasks for the best performance.
await batchClient.JobOperations.AddTaskAsync(this.jobId, tasksToAdd);      

我已通過存儲確認並且批處理憑據正確無誤。

在確定為什么我得到BadRequest任何建議將不勝感激。

堆棧跟蹤:

未處理的異常:System.AggregateException:發生一個或多個錯誤。 ---> Microsoft.Azure.Batch.ParallelOperationsException:對Azure Batch服務的一個或多個請求失敗。 ---> Microsoft.Azure.Batch.Common.BatchException:操作返回了無效的狀態碼'BadRequest'---> Microsoft.Azure.Batch.Protocol.Models.BatchErrorException:操作返回了無效的狀態碼'BadRequest'\\ r \\ n在Microsoft.Azure.Batch.Protocol.TaskOperations.d__7.MoveNext()\\ r \\ n ---從上一個引發異常的位置開始的堆棧跟蹤--- \\ r \\ n在System.Runtime.CompilerServices。 TaskAwaiter.ThrowForNonSuccess(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)\\ r \\ n在Microsoft.Azure.Batch.Protocol.BatchRequestBase 2.<ExecuteRequestWithCancellationAsync>d__43.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.CompilerServices.T askAwaiter.ThrowForNonSuccess(Task task)\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at Microsoft.Azure.Batch.Protocol.BatchRequestBase 2.d__40.MoveNe xt()\\ r \\ n ---內部異常堆棧跟蹤的結尾--- \\ r \\ n在Microsoft.Azure.Batch.Protocol.BatchRequestBase 2.<ExecuteRequestAsync>d__40.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at Microsoft.Azure.Batch.ProtocolLayer.<ProcessAndExecuteBatchRequest>d__83 1.MoveNext()\\ r \\ n ---從上一個引發異常的位置開始的堆棧跟蹤--- \\ r \\ n在System。 Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任務任務)\\ r \\ n在Microsoft.Azure.Batch.AddTasksWorkflowManager.d__16.MoveNext()\\ r \\ n ---從上一個引發異常的位置開始的堆棧結束跟蹤--- \\ r \\ n在Sys tem.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)\\ r \\ n在Microsoft.Azure.Batch.AddTasksWorkflowManager.d__19.MoveNext() r \\ n ---內部異常堆棧跟蹤的結尾--- \\ r \\ n在Microsoft.Azure.Batch.AddTasksWorkflowManager.d__19.MoveNext()\\ r \\ n ---從先前發生異常的位置開始的堆棧跟蹤結束在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)拋出--- \\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)在Microsoft.Azure.Ba tch.AddTasksWorkflowManager.d__18.MoveNext()\\ r \\ n ---從上一個引發異常的位置開始的堆棧跟蹤--- \\ r \\ n位於System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)處\\ r \\ n在Microsoft.Azure.Batch.AddTasksWorkfl owManager.d__13.MoveNext()\\ r \\ n ---從上一個引發異常的位置開始的堆棧結束跟蹤--- \\ r \\ n位於System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)處\\ r \\ n在Microsoft.Azure.Batch.JobOperations.d__43.MoveNext()\\ r \\ n ---從上一個引發異常的位置開始的堆棧結束跟蹤--- \\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\\ r \\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotificationa(任務任務)\\ r \\ n

解決了問題。 我的任務ID包含具有“。”的可執行文件名稱。 在里面。 替換為“。” 加上“-”,就可以了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM