Share via


BatchClient.CreateTasksAsync Method

Definition

Utility method that can take in a large number of tasks to Creates to the specified Job.

public virtual System.Threading.Tasks.Task<Azure.Compute.Batch.CreateTasksResult> CreateTasksAsync(string jobId, System.Collections.Generic.IEnumerable<Azure.Compute.Batch.BatchTaskCreateContent> tasksToAdd, Azure.Compute.Batch.CreateTasksOptions createTasksOptions = default, TimeSpan? timeOutInSeconds = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateTasksAsync : string * seq<Azure.Compute.Batch.BatchTaskCreateContent> * Azure.Compute.Batch.CreateTasksOptions * Nullable<TimeSpan> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Compute.Batch.CreateTasksResult>
override this.CreateTasksAsync : string * seq<Azure.Compute.Batch.BatchTaskCreateContent> * Azure.Compute.Batch.CreateTasksOptions * Nullable<TimeSpan> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Compute.Batch.CreateTasksResult>
Public Overridable Function CreateTasksAsync (jobId As String, tasksToAdd As IEnumerable(Of BatchTaskCreateContent), Optional createTasksOptions As CreateTasksOptions = Nothing, Optional timeOutInSeconds As Nullable(Of TimeSpan) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CreateTasksResult)

Parameters

jobId
String

The ID of the Job to which the Task is to be created.

tasksToAdd
IEnumerable<BatchTaskCreateContent>

A collection of Tasks to be created.

createTasksOptions
CreateTasksOptions

The parallel options associated with this operation. If this is null, the default is used.

timeOutInSeconds
Nullable<TimeSpan>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

jobId or tasksToAdd is null.

jobId is an empty string, and was expected to be non-empty.

Remarks

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