Skip to content

cancel_job_run async

cancel_job_run(
    application_id: ApplicationId,
    job_run_id: JobRunId,
    *,
    config_overrides: Optional[AsyncEMRServerlessClientConfig] = None,
    shutdown_grace_period_in_seconds: Optional[ShutdownGracePeriodInSeconds] = None,
) -> CancelJobRunResponse

Cancels a job run.

Parameters:

  • application_id (ApplicationId) –

    The ID of the application on which the job run will be canceled.

  • job_run_id (JobRunId) –

    The ID of the job run to cancel.

  • shutdown_grace_period_in_seconds (Optional[ShutdownGracePeriodInSeconds], default: None ) –

    The duration in seconds to wait before forcefully terminating the job after cancellation is requested.

Raises:

Source code in docs_src/capo_emr_serverless/_services/async_emr_serverless.py
async def cancel_job_run(
    self,
    application_id: "capo_emr_serverless.types.application_id.ApplicationId",
    job_run_id: "capo_emr_serverless.types.job_run_id.JobRunId",
    *,
    config_overrides: Optional[AsyncEMRServerlessClientConfig] = None,
    shutdown_grace_period_in_seconds: Optional[
        "capo_emr_serverless.types.shutdown_grace_period_in_seconds.ShutdownGracePeriodInSeconds"
    ] = None,
) -> "capo_emr_serverless.types.cancel_job_run_response.CancelJobRunResponse":
    """<p>Cancels a job run.</p>

    Args:
        application_id: <p>The ID of the application on which the job run will be canceled.</p>
        job_run_id: <p>The ID of the job run to cancel.</p>
        shutdown_grace_period_in_seconds: <p>The duration in seconds to wait before forcefully terminating the job after cancellation is requested.</p>

    Raises:
        capo_emr_serverless.errors.internal_server_exception.InternalServerException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_emr_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_emr_serverless.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_emr_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_emr_serverless.types.cancel_job_run_request.CancelJobRunRequest]",
    ) -> AsyncOperationResponse[
        "capo_emr_serverless.types.cancel_job_run_response.CancelJobRunResponse"
    ]:
        import capo_emr_serverless._operations.aws_toledo_web_service.cancel_job_run

        (
            output,
            http_response,
        ) = await capo_emr_serverless._operations.aws_toledo_web_service.cancel_job_run.async_cancel_job_run(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelJobRun")
    )
    input_: capo_emr_serverless.types.cancel_job_run_request.CancelJobRunRequest = {
        "application_id": application_id,
        "job_run_id": job_run_id,
    }
    if shutdown_grace_period_in_seconds is not None:
        input_["shutdown_grace_period_in_seconds"] = (
            shutdown_grace_period_in_seconds
        )

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