Skip to content

cancel_job

cancel_job(
    id: Id, *, config_overrides: Optional[ElasticTranscoderClientConfig] = None
) -> CancelJobResponse

The CancelJob operation cancels an unfinished job.

You can only cancel a job that has a status of Submitted. To prevent a pipeline from starting to process a job while you're getting the job identifier, use UpdatePipelineStatus to temporarily pause the pipeline.

Parameters:

  • id (Id) –

    The identifier of the job that you want to cancel.

    To get a list of the jobs (including their jobId) that have a status of Submitted, use the ListJobsByStatus API action.

Raises:

  • AccessDeniedException –

    General authentication failure. The request was not signed correctly.

  • InternalServiceException –

    Elastic Transcoder encountered an unexpected exception while trying to fulfill the request.

  • ResourceInUseException –

    The resource you are attempting to change is in use. For example, you are attempting to delete a pipeline that is currently in use.

  • ResourceNotFoundException –

    The requested resource does not exist or is not available. For example, the pipeline to which you're trying to add a job doesn't exist or is still being created.

  • ValidationException –

    One or more required parameter values were not provided in the request.

  • UnknownServiceError –

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

Source code in docs_src/capo_elastic_transcoder/_services/elastic_transcoder.py
def cancel_job(
    self,
    id: "capo_elastic_transcoder.types.id.Id",
    *,
    config_overrides: Optional[ElasticTranscoderClientConfig] = None,
) -> "capo_elastic_transcoder.types.cancel_job_response.CancelJobResponse":
    """<p>The CancelJob operation cancels an unfinished job.</p> <note> <p>You can only cancel a job that has a status of <code>Submitted</code>. To prevent a pipeline from starting to process a job while you're getting the job identifier, use <a>UpdatePipelineStatus</a> to temporarily pause the pipeline.</p> </note>

    Args:
        id: <p>The identifier of the job that you want to cancel.</p> <p>To get a list of the jobs (including their <code>jobId</code>) that have a status of <code>Submitted</code>, use the <a>ListJobsByStatus</a> API action.</p>

    Raises:
        capo_elastic_transcoder.errors.access_denied_exception.AccessDeniedException: <p>General authentication failure. The request was not signed correctly.</p>
        capo_elastic_transcoder.errors.incompatible_version_exception.IncompatibleVersionException
        capo_elastic_transcoder.errors.internal_service_exception.InternalServiceException: <p>Elastic Transcoder encountered an unexpected exception while trying to fulfill the request.</p>
        capo_elastic_transcoder.errors.resource_in_use_exception.ResourceInUseException: <p>The resource you are attempting to change is in use. For example, you are attempting to delete a pipeline that is currently in use.</p>
        capo_elastic_transcoder.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource does not exist or is not available. For example, the pipeline to which you're trying to add a job doesn't exist or is still being created.</p>
        capo_elastic_transcoder.errors.validation_exception.ValidationException: <p>One or more required parameter values were not provided in the request.</p>
        capo_elastic_transcoder.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elastic_transcoder.types.cancel_job_request.CancelJobRequest]",
    ) -> OperationResponse[
        "capo_elastic_transcoder.types.cancel_job_response.CancelJobResponse"
    ]:
        import capo_elastic_transcoder._operations.ets_customer_service.cancel_job

        output, http_response = (
            capo_elastic_transcoder._operations.ets_customer_service.cancel_job.cancel_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output