可能是由于您的管道步骤配置错误导致的。检查AWS CloudFormation堆栈是否正确设置,包括管道StateMachineArn,以及用于提示成功或失败的AWS Lambda功能Arn。
另外,您可以在管道步骤中添加一个通用的AWS Lambda步骤来处理成功和失败的事件。以下是示例代码:
import boto3
import time
# Replace with the Arn of your SageMaker endpoint
sagemaker = boto3.client('sagemaker-runtime')
def lambda_handler(event, context):
try:
# Replace with the data you want to pass to SageMaker
response = sagemaker.invoke_endpoint(EndpointName='', Body='')
print(response)
return {
'statusCode': 200,
'body': 'Success'
}
except Exception as e:
print(e)
return {
'statusCode': 400,
'body': 'Failure'
}
此Lambda函数将调用您的SageMaker反向端点,并在成功或失败时返回相应的状态码和消息。您可以将此步骤添加到管道的开始或结束,以确保处理成功和失败的事件。