Skip to content

cancel_job async

cancel_job(
    job_id: JobId, *, config_overrides: Optional[AsyncLocationClientConfig] = None
) -> CancelJobResponse

CancelJob cancels a job that is currently running or pending. If the job is already in a terminal state (Completed, Failed, or Cancelled), the operation returns successfully with the current status.

For more information, see Job concepts in the Amazon Location Service Developer Guide.

Parameters:

  • job_id (JobId) –

    The unique identifier of the job to cancel.

Raises:

  • AccessDeniedException –

    The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.

  • InternalServerException –

    The request has failed to process because of an unknown server error, exception, or failure.

  • ThrottlingException –

    The request was denied because of request throttling.

  • ValidationException –

    The input failed to meet the constraints specified by the AWS service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_location/_services/async_location.py
async def cancel_job(
    self,
    job_id: "capo_location.types.job_id.JobId",
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
) -> "capo_location.types.cancel_job_response.CancelJobResponse":
    """<p> <code>CancelJob</code> cancels a job that is currently running or pending. If the job is already in a terminal state (<code>Completed</code>, <code>Failed</code>, or <code>Cancelled</code>), the operation returns successfully with the current status.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/jobs-concepts.html">Job concepts</a> in the <i>Amazon Location Service Developer Guide</i>.</p>

    Args:
        job_id: <p>The unique identifier of the job to cancel.</p>

    Raises:
        capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
        capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
        capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
        capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
        capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_location.types.cancel_job_request.CancelJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_location.types.cancel_job_response.CancelJobResponse"
    ]:
        import capo_location._operations.location_service.cancel_job

        (
            output,
            http_response,
        ) = await capo_location._operations.location_service.cancel_job.async_cancel_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelJob")
    )
    input_: capo_location.types.cancel_job_request.CancelJobRequest = {
        "job_id": job_id
    }

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