terminateJob method
Terminates a job in a job queue. Jobs that are in the
STARTING
or RUNNING
state are terminated, which
causes them to transition to FAILED
. Jobs that have not
progressed to the STARTING
state are cancelled.
May throw ClientException. May throw ServerException.
Parameter jobId
:
The AWS Batch job ID of the job to terminate.
Parameter 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 AWS Batch activity logs.
Implementation
Future<void> terminateJob({
required String jobId,
required String reason,
}) async {
ArgumentError.checkNotNull(jobId, 'jobId');
ArgumentError.checkNotNull(reason, 'reason');
final $payload = <String, dynamic>{
'jobId': jobId,
'reason': reason,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/terminatejob',
exceptionFnMap: _exceptionFns,
);
}