stopTrainingJob method

Future<void> stopTrainingJob({
  1. required String trainingJobName,
})

Stops a training job. To stop a job, Amazon SageMaker sends the algorithm the SIGTERM signal, which delays job termination for 120 seconds. Algorithms might use this 120-second window to save the model artifacts, so the results of the training is not lost.

When it receives a StopTrainingJob request, Amazon SageMaker changes the status of the job to Stopping. After Amazon SageMaker stops the job, it sets the status to Stopped.

May throw ResourceNotFound.

Parameter trainingJobName : The name of the training job to stop.

Implementation

Future<void> stopTrainingJob({
  required String trainingJobName,
}) async {
  ArgumentError.checkNotNull(trainingJobName, 'trainingJobName');
  _s.validateStringLength(
    'trainingJobName',
    trainingJobName,
    1,
    63,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.StopTrainingJob'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TrainingJobName': trainingJobName,
    },
  );
}