AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the CancelJob operation. Cancels a job in an Batch job queue. Jobs that are in the SUBMITTED or PENDING are canceled. A job inRUNNABLE remains in RUNNABLE until it reaches the head of the job queue. Then the job status is updated to FAILED.

A PENDING job is canceled after all dependency jobs are completed. Therefore, it may take longer than expected to cancel a job in PENDING status.

When you try to cancel an array parent job in PENDING, Batch attempts to cancel all child jobs. The array parent job is canceled when all child jobs are completed.

Jobs that progressed to the STARTING or RUNNING state aren't canceled. However, the API operation still succeeds, even if no job is canceled. These jobs must be terminated with the TerminateJob operation.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.Batch.AmazonBatchRequest
      Amazon.Batch.Model.CancelJobRequest

Namespace: Amazon.Batch.Model
Assembly: AWSSDK.Batch.dll
Version: 3.x.y.z

Syntax

C#
public class CancelJobRequest : AmazonBatchRequest
         IAmazonWebServiceRequest

The CancelJobRequest type exposes the following members

Constructors

NameDescription
Public Method CancelJobRequest()

Properties

NameTypeDescription
Public Property JobId System.String

Gets and sets the property JobId.

The Batch job ID of the job to cancel.

Public Property Reason System.String

Gets and sets the property Reason.

A message to attach to the job that explains the reason for canceling it. This message is returned by future DescribeJobs operations on the job. This message is also recorded in the Batch activity logs.

Examples

This example cancels a job with the specified job ID.

To cancel a job


var client = new AmazonBatchClient();
var response = client.CancelJob(new CancelJobRequest 
{
    JobId = "1d828f65-7a4d-42e8-996d-3b900ed59dc4",
    Reason = "Cancelling job."
});


            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5