Stops a training job. To stop a job, 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, SageMaker changes the status of the job to Stopping. After SageMaker stops the job, it sets the status to Stopped.
Parameters:
Raises:
Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
| async def stop_training_job(
self,
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
training_job_name: Optional[
"capo_sagemaker.types.training_job_name.TrainingJobName"
] = None,
) -> None:
"""<p>Stops a training job. To stop a job, SageMaker sends the algorithm the <code>SIGTERM</code> 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. </p> <p>When it receives a <code>StopTrainingJob</code> request, SageMaker changes the status of the job to <code>Stopping</code>. After SageMaker stops the job, it sets the status to <code>Stopped</code>.</p>
Args:
training_job_name: <p>The name of the training job to stop.</p>
Raises:
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.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sagemaker.types.stop_training_job_request.StopTrainingJobRequest]",
) -> AsyncOperationResponse[None]:
import capo_sagemaker._operations.sage_maker.stop_training_job
(
output,
http_response,
) = await capo_sagemaker._operations.sage_maker.stop_training_job.async_stop_training_job(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StopTrainingJob")
)
input_: capo_sagemaker.types.stop_training_job_request.StopTrainingJobRequest = {}
if training_job_name is not None:
input_["training_job_name"] = training_job_name
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|