Skip to content

cancel_steps async

cancel_steps(
    *,
    config_overrides: Optional[AsyncEMRClientConfig] = None,
    cluster_id: Optional[XmlStringMaxLen256] = None,
    step_ids: Optional[StepIdsList] = None,
    step_cancellation_option: Optional[StepCancellationOption] = None,
) -> CancelStepsOutput

Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions 4.8.0 and later, excluding version 5.0.0. A maximum of 256 steps are allowed in each CancelSteps request. CancelSteps is idempotent but asynchronous; it does not guarantee that a step will be canceled, even if the request is successfully submitted. When you use Amazon EMR releases 5.28.0 and later, you can cancel steps that are in a PENDING or RUNNING state. In earlier versions of Amazon EMR, you can only cancel steps that are in a PENDING state.

Parameters:

Raises:

  • InternalServerError –

    Indicates that an error occurred while processing the request and that the request was not completed.

  • InvalidRequestException –

    This exception occurs when there is something wrong with user input.

  • UnknownServiceError –

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

Source code in docs_src/capo_emr/_services/async_emr.py
async def cancel_steps(
    self,
    *,
    config_overrides: Optional[AsyncEMRClientConfig] = None,
    cluster_id: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    step_ids: Optional["capo_emr.types.step_ids_list.StepIdsList"] = None,
    step_cancellation_option: Optional[
        "capo_emr.types.step_cancellation_option.StepCancellationOption"
    ] = None,
) -> "capo_emr.types.cancel_steps_output.CancelStepsOutput":
    """<p>Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions 4.8.0 and later, excluding version 5.0.0. A maximum of 256 steps are allowed in each CancelSteps request. CancelSteps is idempotent but asynchronous; it does not guarantee that a step will be canceled, even if the request is successfully submitted. When you use Amazon EMR releases 5.28.0 and later, you can cancel steps that are in a <code>PENDING</code> or <code>RUNNING</code> state. In earlier versions of Amazon EMR, you can only cancel steps that are in a <code>PENDING</code> state. </p>

    Args:
        cluster_id: <p>The <code>ClusterID</code> for the specified steps that will be canceled. Use <a>RunJobFlow</a> and <a>ListClusters</a> to get ClusterIDs. </p>
        step_ids: <p>The list of <code>StepIDs</code> to cancel. Use <a>ListSteps</a> to get steps and their states for the specified cluster.</p>
        step_cancellation_option: <p>The option to choose to cancel <code>RUNNING</code> steps. By default, the value is <code>SEND_INTERRUPT</code>.</p>

    Raises:
        capo_emr.errors.internal_server_error.InternalServerError: <p>Indicates that an error occurred while processing the request and that the request was not completed.</p>
        capo_emr.errors.invalid_request_exception.InvalidRequestException: <p>This exception occurs when there is something wrong with user input.</p>
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_emr.types.cancel_steps_input.CancelStepsInput]",
    ) -> AsyncOperationResponse[
        "capo_emr.types.cancel_steps_output.CancelStepsOutput"
    ]:
        import capo_emr._operations.elastic_map_reduce.cancel_steps

        (
            output,
            http_response,
        ) = await capo_emr._operations.elastic_map_reduce.cancel_steps.async_cancel_steps(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelSteps")
    )
    input_: capo_emr.types.cancel_steps_input.CancelStepsInput = {}
    if cluster_id is not None:
        input_["cluster_id"] = cluster_id
    if step_ids is not None:
        input_["step_ids"] = step_ids
    if step_cancellation_option is not None:
        input_["step_cancellation_option"] = step_cancellation_option

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