Azure Batch .net tutorial显示删除任务,然后是作业,然后是池。同时,我发现这个article有关清理,而不是删除作业和池,它只是删除不再使用的VM。这是一个好策略吗?我看到它可以帮助跟踪任务和一般组织,但是在删除已完成的任务的vms之后保留任务,作业和池有什么含义?
更新2018-05-15
给定作业中的最大任务数为7770。
我按照下面的答案,最后得到了一份累计完成7770项任务的工作。在这个神奇的数字之后,批处理服务不再能够向作业添加新任务,抛出以下异常:
System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Batch.Common.BatchException: InternalError: Server encountered an internal error. Please try again after some time.
RequestId:e6ab60e0-5c3b-4116-9ffb-ba2032154318
Time:2018-05-15T11:17:17.2186951Z
at Microsoft.Azure.Batch.Protocol.CloudPoolOperations.<GetAsync>d__65.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Batch.Protocol.BatchRequest`2.<ExecuteRequestWithCancellationAsync>d__c.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Batch.Protocol.BatchRequest`2.<ExecuteRequestAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Batch.ProtocolLayer.<ProcessAndExecuteBatchRequest>d__11b`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Batch.PoolOperations.<GetPoolAsync>d__3.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.Azure.Batch.PoolOperations.GetPool(String poolId, DetailLevel detailLevel, IEnumerable`1 additionalBehaviors)
at Pepe.Helpers.Batch.CreatePool()
at Pepe.Helpers.LogEntryMaintainer.LaunchJob(LogFile log, PepeEntities db)
我建议定期清理历史数据。如果你需要在某个地方保留这些信息,我建议移动到某个地方,比如桌面存储。
答案 0 :(得分:4)
您根本不需要删除任务或其作业,并且没有将它们留在系统中的真正缺点。您执行但需要在完成时终止作业,因为批处理帐户中的活动作业数量有一个配额。
关于池和虚拟机,您真正应该如何管理资源(特别是考虑到这些花费您的资金)。常见方法包括;
希望有所帮助。