Share via


TaskOperationsExtensions.AddAsync Method

Definition

Adds a Task to the specified Job.

public static System.Threading.Tasks.Task<Microsoft.Azure.Batch.Protocol.Models.TaskAddHeaders> AddAsync (this Microsoft.Azure.Batch.Protocol.ITaskOperations operations, string jobId, Microsoft.Azure.Batch.Protocol.Models.TaskAddParameter task, Microsoft.Azure.Batch.Protocol.Models.TaskAddOptions taskAddOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member AddAsync : Microsoft.Azure.Batch.Protocol.ITaskOperations * string * Microsoft.Azure.Batch.Protocol.Models.TaskAddParameter * Microsoft.Azure.Batch.Protocol.Models.TaskAddOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Batch.Protocol.Models.TaskAddHeaders>
<Extension()>
Public Function AddAsync (operations As ITaskOperations, jobId As String, task As TaskAddParameter, Optional taskAddOptions As TaskAddOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TaskAddHeaders)

Parameters

operations
ITaskOperations

The operations group for this extension method.

jobId
String

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

task
TaskAddParameter

The Task to be added.

taskAddOptions
TaskAddOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

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