Skip to content

delete_job async

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

Deletes a job. This operation is idempotent. If the job is currently running, you must stop it before deleting it by calling StopJob.

The following operations are related to DeleteJob:

  • CreateJob

  • StopJob

  • DescribeJob

Parameters:

  • job_name (Optional[JobName], default: None ) –

    The name of the job to delete.

  • job_category (Optional[JobCategory], default: None ) –

    The category of the job to delete.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def delete_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.delete_job_response.DeleteJobResponse":
    """<p>Deletes a job. This operation is idempotent. If the job is currently running, you must stop it before deleting it by calling <code>StopJob</code>.</p> <p>The following operations are related to <code>DeleteJob</code>:</p> <ul> <li> <p> <code>CreateJob</code> </p> </li> <li> <p> <code>StopJob</code> </p> </li> <li> <p> <code>DescribeJob</code> </p> </li> </ul>

    Args:
        job_name: <p>The name of the job to delete.</p>
        job_category: <p>The category of the 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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.delete_job_request.DeleteJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.delete_job_response.DeleteJobResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.delete_job

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteJob")
    )
    input_: capo_sagemaker.types.delete_job_request.DeleteJobRequest = {}
    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