Skip to content

stop_pipeline_execution

stop_pipeline_execution(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    pipeline_execution_arn: Optional[PipelineExecutionArn] = None,
    client_request_token: Optional[IdempotencyToken] = None,
) -> StopPipelineExecutionResponse

Stops a pipeline execution.

Callback Step

A pipeline execution won't stop while a callback step is running. When you call StopPipelineExecution on a pipeline execution with a running callback step, SageMaker Pipelines sends an additional Amazon SQS message to the specified SQS queue. The body of the SQS message contains a "Status" field which is set to "Stopping".

You should add logic to your Amazon SQS message consumer to take any needed action (for example, resource cleanup) upon receipt of the message followed by a call to SendPipelineExecutionStepSuccess or SendPipelineExecutionStepFailure.

Only when SageMaker Pipelines receives one of these calls will it stop the pipeline execution.

Lambda Step

A pipeline execution can't be stopped while a lambda step is running because the Lambda function invoked by the lambda step can't be stopped. If you attempt to stop the execution while the Lambda function is running, the pipeline waits for the Lambda function to finish or until the timeout is hit, whichever occurs first, and then stops. If the Lambda function finishes, the pipeline execution status is Stopped. If the timeout is hit the pipeline execution status is Failed.

Parameters:

  • pipeline_execution_arn (Optional[PipelineExecutionArn], default: None ) –

    The Amazon Resource Name (ARN) of the pipeline execution.

  • client_request_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An idempotent operation completes no more than once.

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

  • ResourceNotFound –

    Resource being access is not found.

  • UnknownServiceError –

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

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def stop_pipeline_execution(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    pipeline_execution_arn: Optional[
        "capo_sagemaker.types.pipeline_execution_arn.PipelineExecutionArn"
    ] = None,
    client_request_token: Optional[
        "capo_sagemaker.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_sagemaker.types.stop_pipeline_execution_response.StopPipelineExecutionResponse":
    """<p>Stops a pipeline execution.</p> <p> <b>Callback Step</b> </p> <p>A pipeline execution won't stop while a callback step is running. When you call <code>StopPipelineExecution</code> on a pipeline execution with a running callback step, SageMaker Pipelines sends an additional Amazon SQS message to the specified SQS queue. The body of the SQS message contains a "Status" field which is set to "Stopping".</p> <p>You should add logic to your Amazon SQS message consumer to take any needed action (for example, resource cleanup) upon receipt of the message followed by a call to <code>SendPipelineExecutionStepSuccess</code> or <code>SendPipelineExecutionStepFailure</code>.</p> <p>Only when SageMaker Pipelines receives one of these calls will it stop the pipeline execution.</p> <p> <b>Lambda Step</b> </p> <p>A pipeline execution can't be stopped while a lambda step is running because the Lambda function invoked by the lambda step can't be stopped. If you attempt to stop the execution while the Lambda function is running, the pipeline waits for the Lambda function to finish or until the timeout is hit, whichever occurs first, and then stops. If the Lambda function finishes, the pipeline execution status is <code>Stopped</code>. If the timeout is hit the pipeline execution status is <code>Failed</code>.</p>

    Args:
        pipeline_execution_arn: <p>The Amazon Resource Name (ARN) of the pipeline execution.</p>
        client_request_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An idempotent operation completes no more than once.</p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.stop_pipeline_execution_request.StopPipelineExecutionRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.stop_pipeline_execution_response.StopPipelineExecutionResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.stop_pipeline_execution

        output, http_response = (
            capo_sagemaker._operations.sage_maker.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_sagemaker.types.stop_pipeline_execution_request.StopPipelineExecutionRequest = {}
    if pipeline_execution_arn is not None:
        input_["pipeline_execution_arn"] = pipeline_execution_arn
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token

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