Skip to content

stop_pipeline_execution

stop_pipeline_execution(
    pipeline_name: PipelineName,
    pipeline_execution_id: PipelineExecutionId,
    *,
    config_overrides: Optional[CodePipelineClientConfig] = None,
    abandon: Optional[Boolean] = None,
    reason: Optional[StopPipelineExecutionReason] = None,
) -> StopPipelineExecutionOutput

Stops the specified pipeline execution. You choose to either stop the pipeline execution by completing in-progress actions without starting subsequent actions, or by abandoning in-progress actions. While completing or abandoning in-progress actions, the pipeline execution is in a Stopping state. After all in-progress actions are completed or abandoned, the pipeline execution is in a Stopped state.

Parameters:

  • pipeline_name (PipelineName) –

    The name of the pipeline to stop.

  • pipeline_execution_id (PipelineExecutionId) –

    The ID of the pipeline execution to be stopped in the current stage. Use the GetPipelineState action to retrieve the current pipelineExecutionId.

  • abandon (Optional[Boolean], default: None ) –

    Use this option to stop the pipeline execution by abandoning, rather than finishing, in-progress actions.

    This option can lead to failed or out-of-sequence tasks.

  • reason (Optional[StopPipelineExecutionReason], default: None ) –

    Use this option to enter comments, such as the reason the pipeline was stopped.

Raises:

  • ConflictException –

    Your request cannot be handled because the pipeline is busy handling ongoing activities. Try again later.

  • DuplicatedStopRequestException –

    The pipeline execution is already in a Stopping state. If you already chose to stop and wait, you cannot make that request again. You can choose to stop and abandon now, but be aware that this option can lead to failed tasks or out of sequence tasks. If you already chose to stop and abandon, you cannot make that request again.

  • PipelineExecutionNotStoppableException –

    Unable to stop the pipeline execution. The execution might already be in a Stopped state, or it might no longer be in progress.

  • PipelineNotFoundException –

    The pipeline was specified in an invalid format or cannot be found.

  • ValidationException –

    The validation was specified in an invalid format.

  • UnknownServiceError –

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

Source code in docs_src/capo_codepipeline/_services/code_pipeline.py
def stop_pipeline_execution(
    self,
    pipeline_name: "capo_codepipeline.types.pipeline_name.PipelineName",
    pipeline_execution_id: "capo_codepipeline.types.pipeline_execution_id.PipelineExecutionId",
    *,
    config_overrides: Optional[CodePipelineClientConfig] = None,
    abandon: Optional["capo_codepipeline.types.boolean.Boolean"] = None,
    reason: Optional[
        "capo_codepipeline.types.stop_pipeline_execution_reason.StopPipelineExecutionReason"
    ] = None,
) -> "capo_codepipeline.types.stop_pipeline_execution_output.StopPipelineExecutionOutput":
    """<p>Stops the specified pipeline execution. You choose to either stop the pipeline execution by completing in-progress actions without starting subsequent actions, or by abandoning in-progress actions. While completing or abandoning in-progress actions, the pipeline execution is in a <code>Stopping</code> state. After all in-progress actions are completed or abandoned, the pipeline execution is in a <code>Stopped</code> state.</p>

    Args:
        pipeline_name: <p>The name of the pipeline to stop.</p>
        pipeline_execution_id: <p>The ID of the pipeline execution to be stopped in the current stage. Use the <code>GetPipelineState</code> action to retrieve the current pipelineExecutionId.</p>
        abandon: <p>Use this option to stop the pipeline execution by abandoning, rather than finishing, in-progress actions.</p> <note> <p>This option can lead to failed or out-of-sequence tasks.</p> </note>
        reason: <p>Use this option to enter comments, such as the reason the pipeline was stopped.</p>

    Raises:
        capo_codepipeline.errors.conflict_exception.ConflictException: <p>Your request cannot be handled because the pipeline is busy handling ongoing activities. Try again later.</p>
        capo_codepipeline.errors.duplicated_stop_request_exception.DuplicatedStopRequestException: <p>The pipeline execution is already in a <code>Stopping</code> state. If you already chose to stop and wait, you cannot make that request again. You can choose to stop and abandon now, but be aware that this option can lead to failed tasks or out of sequence tasks. If you already chose to stop and abandon, you cannot make that request again.</p>
        capo_codepipeline.errors.pipeline_execution_not_stoppable_exception.PipelineExecutionNotStoppableException: <p>Unable to stop the pipeline execution. The execution might already be in a <code>Stopped</code> state, or it might no longer be in progress.</p>
        capo_codepipeline.errors.pipeline_not_found_exception.PipelineNotFoundException: <p>The pipeline was specified in an invalid format or cannot be found.</p>
        capo_codepipeline.errors.validation_exception.ValidationException: <p>The validation was specified in an invalid format.</p>
        capo_codepipeline.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codepipeline.types.stop_pipeline_execution_input.StopPipelineExecutionInput]",
    ) -> OperationResponse[
        "capo_codepipeline.types.stop_pipeline_execution_output.StopPipelineExecutionOutput"
    ]:
        import capo_codepipeline._operations.code_pipeline_20150709.stop_pipeline_execution

        output, http_response = (
            capo_codepipeline._operations.code_pipeline_20150709.stop_pipeline_execution.stop_pipeline_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StopPipelineExecution")
    )
    input_: capo_codepipeline.types.stop_pipeline_execution_input.StopPipelineExecutionInput = {
        "pipeline_name": pipeline_name,
        "pipeline_execution_id": pipeline_execution_id,
    }
    if abandon is not None:
        input_["abandon"] = abandon
    if reason is not None:
        input_["reason"] = reason

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