Stops a running training session and sets the session status to Stopping. After the session stops, the status changes to Stopped. To delete a stopped session, use the DeleteTrainingSession operation.
The following operations are related to StopTrainingSession:
-
CreateTrainingSession
-
DescribeTrainingSession
-
DeleteTrainingSession
Parameters:
Raises:
Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
| async def stop_training_session(
self,
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
training_session_name: Optional[
"capo_sagemaker.types.training_session_name.TrainingSessionName"
] = None,
) -> "capo_sagemaker.types.stop_training_session_response.StopTrainingSessionResponse":
"""<p>Stops a running training session and sets the session status to <code>Stopping</code>. After the session stops, the status changes to <code>Stopped</code>. To delete a stopped session, use the <code>DeleteTrainingSession</code> operation.</p> <p>The following operations are related to <code>StopTrainingSession</code>:</p> <ul> <li> <p> <code>CreateTrainingSession</code> </p> </li> <li> <p> <code>DescribeTrainingSession</code> </p> </li> <li> <p> <code>DeleteTrainingSession</code> </p> </li> </ul>
Args:
training_session_name: <p>The name of the training session 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_session_request.StopTrainingSessionRequest]",
) -> AsyncOperationResponse[
"capo_sagemaker.types.stop_training_session_response.StopTrainingSessionResponse"
]:
import capo_sagemaker._operations.sage_maker.stop_training_session
(
output,
http_response,
) = await capo_sagemaker._operations.sage_maker.stop_training_session.async_stop_training_session(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StopTrainingSession")
)
input_: capo_sagemaker.types.stop_training_session_request.StopTrainingSessionRequest = {}
if training_session_name is not None:
input_["training_session_name"] = training_session_name
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|