Condividi tramite


JobOperationsExtensions.TerminateAsync Method

Definition

Terminates the specified Job, marking it as completed.

public static System.Threading.Tasks.Task<Microsoft.Azure.Batch.Protocol.Models.JobTerminateHeaders> TerminateAsync (this Microsoft.Azure.Batch.Protocol.IJobOperations operations, string jobId, string terminateReason = default, Microsoft.Azure.Batch.Protocol.Models.JobTerminateOptions jobTerminateOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member TerminateAsync : Microsoft.Azure.Batch.Protocol.IJobOperations * string * string * Microsoft.Azure.Batch.Protocol.Models.JobTerminateOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Batch.Protocol.Models.JobTerminateHeaders>
<Extension()>
Public Function TerminateAsync (operations As IJobOperations, jobId As String, Optional terminateReason As String = Nothing, Optional jobTerminateOptions As JobTerminateOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of JobTerminateHeaders)

Parameters

operations
IJobOperations

The operations group for this extension method.

jobId
String

The ID of the Job to terminate.

terminateReason
String

The text you want to appear as the Job's TerminateReason. The default is 'UserTerminate'.

jobTerminateOptions
JobTerminateOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Remarks

When a Terminate Job request is received, the Batch service sets the Job to the terminating state. The Batch service then terminates any running Tasks associated with the Job and runs any required Job release Tasks. Then the Job moves into the completed state. If there are any Tasks in the Job in the active state, they will remain in the active state. Once a Job is terminated, new Tasks cannot be added and any remaining active Tasks will not be scheduled.

Applies to