BatchClient.TerminateTask Method

Definition

Overloads

Name Description
TerminateTask(String, String, Nullable<TimeSpan>, Nullable<DateTimeOffset>, RequestConditions, CancellationToken)

When the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background.

TerminateTask(String, String, Nullable<TimeSpan>, Nullable<DateTimeOffset>, RequestConditions, RequestContext)

[Protocol Method] When the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.

TerminateTask(String, String, Nullable<TimeSpan>, Nullable<DateTimeOffset>, RequestConditions, CancellationToken)

Source:
BatchClient.cs
Source:
BatchClient.cs

When the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background.

public virtual Azure.Response TerminateTask(string jobId, string taskId, TimeSpan? timeout = default, DateTimeOffset? requestDate = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
public virtual Azure.Response TerminateTask(string jobId, string taskId, TimeSpan? timeOutInSeconds = default, DateTimeOffset? ocpDate = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response
override this.TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response
abstract member TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response
override this.TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response
Public Overridable Function TerminateTask (jobId As String, taskId As String, Optional timeout As Nullable(Of TimeSpan) = Nothing, Optional requestDate As Nullable(Of DateTimeOffset) = Nothing, Optional requestConditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response
Public Overridable Function TerminateTask (jobId As String, taskId As String, 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 Response

Parameters

jobId
String

The ID of the Job containing the Task.

taskId
String

The ID of the Task to terminate.

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

requestDateocpDate
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 that can be used to cancel the operation.

Returns

Exceptions

jobId or taskId is null.

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

Service returned a non-success status code.

Applies to

TerminateTask(String, String, Nullable<TimeSpan>, Nullable<DateTimeOffset>, RequestConditions, RequestContext)

Source:
BatchClient.cs
Source:
BatchClient.cs

[Protocol Method] When the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Response TerminateTask(string jobId, string taskId, TimeSpan? timeout, DateTimeOffset? requestDate, Azure.RequestConditions requestConditions, Azure.RequestContext context);
public virtual Azure.Response TerminateTask(string jobId, string taskId, TimeSpan? timeOutInSeconds, DateTimeOffset? ocpDate, Azure.RequestConditions requestConditions, Azure.RequestContext context);
abstract member TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
override this.TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
abstract member TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
override this.TerminateTask : string * string * Nullable<TimeSpan> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
Public Overridable Function TerminateTask (jobId As String, taskId As String, timeout As Nullable(Of TimeSpan), requestDate As Nullable(Of DateTimeOffset), requestConditions As RequestConditions, context As RequestContext) As Response
Public Overridable Function TerminateTask (jobId As String, taskId As String, timeOutInSeconds As Nullable(Of TimeSpan), ocpDate As Nullable(Of DateTimeOffset), requestConditions As RequestConditions, context As RequestContext) As Response

Parameters

jobId
String

The ID of the Job containing the Task.

taskId
String

The ID of the Task to terminate.

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

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

context
RequestContext

The request options, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

jobId or taskId is null.

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

Service returned a non-success status code.

Examples

This sample shows how to call TerminateTask.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

Response response = client.TerminateTask("jobId", "taskId");

Console.WriteLine(response.Status);

Applies to