Share via


BatchClient.DisableJobAsync Method

Definition

Disables the specified Job, preventing new Tasks from running.

public virtual System.Threading.Tasks.Task<Azure.Compute.Batch.DisableJobOperation> DisableJobAsync(string jobId, Azure.Compute.Batch.BatchJobDisableOptions disableOptions, TimeSpan? timeOutInSeconds = default, DateTimeOffset? ocpDate = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DisableJobAsync : string * Azure.Compute.Batch.BatchJobDisableOptions * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Compute.Batch.DisableJobOperation>
override this.DisableJobAsync : string * Azure.Compute.Batch.BatchJobDisableOptions * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Compute.Batch.DisableJobOperation>
Public Overridable Function DisableJobAsync (jobId As String, disableOptions As BatchJobDisableOptions, Optional timeOutInSeconds As Nullable(Of TimeSpan) = Nothing, Optional ocpDate As Nullable(Of DateTimeOffset) = Nothing, Optional requestConditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DisableJobOperation)

Parameters

jobId
String

The ID of the Job to disable.

disableOptions
BatchJobDisableOptions

The options to use for disabling 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.

requestConditions
RequestConditions

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

cancellationToken
CancellationToken

The cancellation token to use.

Returns

The DisableJobOperation object to allow for polling of operation status.

Exceptions

jobId or disableOptions is null.

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

Remarks

The Batch Service immediately moves the Job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running Tasks of the Job. The Job remains in the disabling state until the disable operation is completed and all Tasks have been dealt with according to the disableTasks option; the Job then moves to the disabled state. No new Tasks are started under the Job until it moves back to active state. If you try to disable a Job that is in any state other than active, disabling, or disabled, the request fails with status code 409.

Applies to