Deletes a training job. After SageMaker deletes a training job, all of the metadata for the training job is lost. You can delete only training jobs that are in a terminal state (Stopped, Failed, or Completed) and don't retain an Available managed warm pool. You cannot delete a job that is in the InProgress or Stopping state. After deleting the job, you can reuse its name to create another training job.
Parameters:
Raises:
Source code in docs_src/capo_sagemaker/_services/sage_maker.py
| def delete_training_job(
self,
*,
config_overrides: Optional[SageMakerClientConfig] = None,
training_job_name: Optional[
"capo_sagemaker.types.training_job_name.TrainingJobName"
] = None,
) -> None:
"""<p>Deletes a training job. After SageMaker deletes a training job, all of the metadata for the training job is lost. You can delete only training jobs that are in a terminal state (<code>Stopped</code>, <code>Failed</code>, or <code>Completed</code>) and don't retain an <code>Available</code> <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/train-warm-pools.html">managed warm pool</a>. You cannot delete a job that is in the <code>InProgress</code> or <code>Stopping</code> state. After deleting the job, you can reuse its name to create another training job.</p>
Args:
training_job_name: <p>The name of the training job to delete.</p>
Raises:
capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_sagemaker.types.delete_training_job_request.DeleteTrainingJobRequest]",
) -> OperationResponse[None]:
import capo_sagemaker._operations.sage_maker.delete_training_job
output, http_response = (
capo_sagemaker._operations.sage_maker.delete_training_job.delete_training_job(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteTrainingJob")
)
input_: capo_sagemaker.types.delete_training_job_request.DeleteTrainingJobRequest = {}
if training_job_name is not None:
input_["training_job_name"] = training_job_name
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|