Skip to content

cancel_flow_executions async

cancel_flow_executions(
    flow_name: FlowName,
    *,
    config_overrides: Optional[AsyncAppflowClientConfig] = None,
    execution_ids: Optional[ExecutionIds] = None,
) -> CancelFlowExecutionsResponse

Cancels active runs for a flow.

You can cancel all of the active runs for a flow, or you can cancel specific runs by providing their IDs.

You can cancel a flow run only when the run is in progress. You can't cancel a run that has already completed or failed. You also can't cancel a run that's scheduled to occur but hasn't started yet. To prevent a scheduled run, you can deactivate the flow with the StopFlow action.

You cannot resume a run after you cancel it.

When you send your request, the status for each run becomes CancelStarted. When the cancellation completes, the status becomes Canceled.

When you cancel a run, you still incur charges for any data that the run already processed before the cancellation. If the run had already written some data to the flow destination, then that data remains in the destination. If you configured the flow to use a batch API (such as the Salesforce Bulk API 2.0), then the run will finish reading or writing its entire batch of data after the cancellation. For these operations, the data processing charges for Amazon AppFlow apply. For the pricing information, see Amazon AppFlow pricing.

Parameters:

  • flow_name (FlowName) –

    The name of a flow with active runs that you want to cancel.

  • execution_ids (Optional[ExecutionIds], default: None ) –

    The ID of each active run to cancel. These runs must belong to the flow you specify in your request.

    If you omit this parameter, your request ends all active runs that belong to the flow.

Raises:

Source code in docs_src/capo_appflow/_services/async_appflow.py
async def cancel_flow_executions(
    self,
    flow_name: "capo_appflow.types.flow_name.FlowName",
    *,
    config_overrides: Optional[AsyncAppflowClientConfig] = None,
    execution_ids: Optional["capo_appflow.types.execution_ids.ExecutionIds"] = None,
) -> "capo_appflow.types.cancel_flow_executions_response.CancelFlowExecutionsResponse":
    """<p>Cancels active runs for a flow.</p> <p>You can cancel all of the active runs for a flow, or you can cancel specific runs by providing their IDs.</p> <p>You can cancel a flow run only when the run is in progress. You can't cancel a run that has already completed or failed. You also can't cancel a run that's scheduled to occur but hasn't started yet. To prevent a scheduled run, you can deactivate the flow with the <code>StopFlow</code> action.</p> <p>You cannot resume a run after you cancel it.</p> <p>When you send your request, the status for each run becomes <code>CancelStarted</code>. When the cancellation completes, the status becomes <code>Canceled</code>.</p> <note> <p>When you cancel a run, you still incur charges for any data that the run already processed before the cancellation. If the run had already written some data to the flow destination, then that data remains in the destination. If you configured the flow to use a batch API (such as the Salesforce Bulk API 2.0), then the run will finish reading or writing its entire batch of data after the cancellation. For these operations, the data processing charges for Amazon AppFlow apply. For the pricing information, see <a href="http://aws.amazon.com/appflow/pricing/">Amazon AppFlow pricing</a>.</p> </note>

    Args:
        flow_name: <p>The name of a flow with active runs that you want to cancel.</p>
        execution_ids: <p>The ID of each active run to cancel. These runs must belong to the flow you specify in your request.</p> <p>If you omit this parameter, your request ends all active runs that belong to the flow.</p>

    Raises:
        capo_appflow.errors.access_denied_exception.AccessDeniedException: <p>AppFlow/Requester has invalid or missing permissions.</p>
        capo_appflow.errors.internal_server_exception.InternalServerException: <p> An internal service error occurred during the processing of your request. Try again later. </p>
        capo_appflow.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource specified in the request (such as the source or destination connector profile) is not found. </p>
        capo_appflow.errors.throttling_exception.ThrottlingException: <p>API calls have exceeded the maximum allowed API request rate per account and per Region. </p>
        capo_appflow.errors.validation_exception.ValidationException: <p> The request has invalid or missing parameters. </p>
        capo_appflow.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_appflow.types.cancel_flow_executions_request.CancelFlowExecutionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_appflow.types.cancel_flow_executions_response.CancelFlowExecutionsResponse"
    ]:
        import capo_appflow._operations.sandstone_configuration_service_lambda.cancel_flow_executions

        (
            output,
            http_response,
        ) = await capo_appflow._operations.sandstone_configuration_service_lambda.cancel_flow_executions.async_cancel_flow_executions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelFlowExecutions")
    )
    input_: capo_appflow.types.cancel_flow_executions_request.CancelFlowExecutionsRequest = {
        "flow_name": flow_name
    }
    if execution_ids is not None:
        input_["execution_ids"] = execution_ids

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