IJobOperations.TerminateWithHttpMessagesAsync Method

Definition

Terminates the specified Job, marking it as completed.

public System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationHeaderResponse<Microsoft.Azure.Batch.Protocol.Models.JobTerminateHeaders>> TerminateWithHttpMessagesAsync (string jobId, string terminateReason = default, Microsoft.Azure.Batch.Protocol.Models.JobTerminateOptions jobTerminateOptions = default, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member TerminateWithHttpMessagesAsync : string * string * Microsoft.Azure.Batch.Protocol.Models.JobTerminateOptions * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationHeaderResponse<Microsoft.Azure.Batch.Protocol.Models.JobTerminateHeaders>>
Public Function TerminateWithHttpMessagesAsync (jobId As String, Optional terminateReason As String = Nothing, Optional jobTerminateOptions As JobTerminateOptions = Nothing, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationHeaderResponse(Of JobTerminateHeaders))

Parameters

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

customHeaders
Dictionary<String,List<String>>

The headers that will be added to request.

cancellationToken
CancellationToken

The cancellation token.

Returns

Exceptions

Thrown when the operation returned an invalid status code

Thrown when a required parameter is null

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