Skip to content

stop_job async

stop_job(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    job_name: Optional[JobName] = None,
    job_category: Optional[JobCategory] = None,
) -> StopJobResponse

Stops a running job. When you call StopJob, Amazon SageMaker sets the job status to Stopping. After the job stops, the status changes to Stopped. Partial results may be available in the output location if the job was in progress. To delete a stopped job, call DeleteJob.

The following operations are related to StopJob:

  • CreateJob

  • DescribeJob

  • DeleteJob

Parameters:

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def stop_job(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    job_name: Optional["capo_sagemaker.types.job_name.JobName"] = None,
    job_category: Optional["capo_sagemaker.types.job_category.JobCategory"] = None,
) -> "capo_sagemaker.types.stop_job_response.StopJobResponse":
    """<p>Stops a running job. When you call <code>StopJob</code>, Amazon SageMaker sets the job status to <code>Stopping</code>. After the job stops, the status changes to <code>Stopped</code>. Partial results may be available in the output location if the job was in progress. To delete a stopped job, call <code>DeleteJob</code>.</p> <p>The following operations are related to <code>StopJob</code>:</p> <ul> <li> <p> <code>CreateJob</code> </p> </li> <li> <p> <code>DescribeJob</code> </p> </li> <li> <p> <code>DeleteJob</code> </p> </li> </ul>

    Args:
        job_name: <p>The name of the job to stop.</p>
        job_category: <p>The category of the 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_job_request.StopJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.stop_job_response.StopJobResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.stop_job

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.stop_job.async_stop_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StopJob")
    )
    input_: capo_sagemaker.types.stop_job_request.StopJobRequest = {}
    if job_name is not None:
        input_["job_name"] = job_name
    if job_category is not None:
        input_["job_category"] = job_category

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output