다음을 통해 공유


TaskOperationsExtensions.AddCollectionAsync Method

Definition

Adds a collection of Tasks to the specified Job.

public static System.Threading.Tasks.Task<Microsoft.Azure.Batch.Protocol.Models.TaskAddCollectionResult> AddCollectionAsync (this Microsoft.Azure.Batch.Protocol.ITaskOperations operations, string jobId, System.Collections.Generic.IList<Microsoft.Azure.Batch.Protocol.Models.TaskAddParameter> value, Microsoft.Azure.Batch.Protocol.Models.TaskAddCollectionOptions taskAddCollectionOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member AddCollectionAsync : Microsoft.Azure.Batch.Protocol.ITaskOperations * string * System.Collections.Generic.IList<Microsoft.Azure.Batch.Protocol.Models.TaskAddParameter> * Microsoft.Azure.Batch.Protocol.Models.TaskAddCollectionOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Batch.Protocol.Models.TaskAddCollectionResult>
<Extension()>
Public Function AddCollectionAsync (operations As ITaskOperations, jobId As String, value As IList(Of TaskAddParameter), Optional taskAddCollectionOptions As TaskAddCollectionOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TaskAddCollectionResult)

Parameters

operations
ITaskOperations

The operations group for this extension method.

jobId
String

The ID of the Job to which the Task collection is to be added.

value
IList<TaskAddParameter>

The collection of Tasks to add. The maximum count of Tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks.

taskAddCollectionOptions
TaskAddCollectionOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Remarks

Note that each Task must have a unique ID. The Batch service may not return the results for each Task in the same order the Tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same Task IDs during a retry so that if the prior operation succeeded, the retry will not create extra Tasks unexpectedly. If the response contains any Tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only Tasks that failed to add, and to omit Tasks that were successfully added on the first attempt. The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.

Applies to