JobOperationsExtensions.TerminateAsync Method

Definition

Terminates the specified Job, marking it as completed.

C#
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);

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

Product Versions
Azure SDK for .NET Latest