Cancels up to 50 jobs in an Batch job queue¶
Description¶
Cancels up to 50 jobs in an Batch job queue. This is a bulk version of cancel_job. Jobs that are in a SUBMITTED, PENDING, or RUNNABLE state are cancelled and the job status is updated to FAILED.
A PENDING job is cancelled after all dependency jobs are completed. Therefore, it might 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 cancelled when all child jobs are completed.
Jobs that progressed to the STARTING or RUNNING state aren't cancelled. These jobs must be terminated with the terminate_job or terminate_jobs operation.
Batch reports the result for each job individually in the response. Jobs that were processed successfully are reported in the successful list. Jobs that encountered errors are reported in the errors list. The response returns an HTTP status code of 200 even when some jobs encountered errors, so check the errors list. Jobs that can't be found are treated as successfully processed.
This operation requires batch:CancelJob permission for each job in the request. There is no separate batch:CancelJobs IAM action. If a caller's IAM policy grants batch:CancelJob, they can use both the singular cancel_job and bulk cancel_jobs operations.
Usage¶
Arguments¶
jobs
[required] An array of up to 50 Batch job IDs of the jobs to cancel.
reason
[required] A message to attach to the job that explains the reason for cancelling it. This message is returned by future describe_jobs operations on the job. It is also recorded in the Batch activity logs.
This parameter has a limit of 1024 characters.
Value¶
A list with the following syntax:
list(
successful = list(
"string"
),
errors = list(
list(
job = "string",
code = "string",
message = "string"
)
)
)