Share via


BatchClient.TerminateJob Method

Definition

Terminates the specified Job, marking it as completed.

public virtual Azure.Compute.Batch.TerminateJobOperation TerminateJob(string jobId, Azure.Compute.Batch.BatchJobTerminateOptions parameters = default, TimeSpan? timeOutInSeconds = default, DateTimeOffset? ocpDate = default, bool? force = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member TerminateJob : string * Azure.Compute.Batch.BatchJobTerminateOptions * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Nullable<bool> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Compute.Batch.TerminateJobOperation
override this.TerminateJob : string * Azure.Compute.Batch.BatchJobTerminateOptions * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Nullable<bool> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Compute.Batch.TerminateJobOperation
Public Overridable Function TerminateJob (jobId As String, Optional parameters As BatchJobTerminateOptions = Nothing, Optional timeOutInSeconds As Nullable(Of TimeSpan) = Nothing, Optional ocpDate As Nullable(Of DateTimeOffset) = Nothing, Optional force As Nullable(Of Boolean) = Nothing, Optional requestConditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As TerminateJobOperation

Parameters

jobId
String

The ID of the Job to terminate.

parameters
BatchJobTerminateOptions

The options to use for terminating the Job.

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.".

ocpDate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

force
Nullable<Boolean>

If true, the server will terminate the Job even if the corresponding nodes have not fully processed the termination. The default value is false.

requestConditions
RequestConditions

The content to send as the request conditions of the request.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

The TerminateJobOperation object to allow for polling of operation status.

Exceptions

jobId is null.

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

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