【问题标题】:Logs not coming for endpoint being created in sagemaker在 sagemaker 中创建的端点没有日志
【发布时间】:2021-11-29 16:58:20
【问题描述】:

我正在尝试通过 sagemaker 创建一个端点。终端节点的状态变为失败,并显示消息“生产变体 variantName 的主容器未通过 ping 运行状况检查。请检查此终端节点的 CloudWatch 日志”。

但是没有创建日志来检查。

很久以前就被屏蔽了,有人知道为什么会发生这种情况

【问题讨论】:

  • 您可以尝试使用 Python SageMaker SDK 调用它(本地)吗?它将在您的本地控制台中显示更多信息

标签: amazon-web-services amazon-sagemaker


【解决方案1】:

您错过了在model_handler.py 文件中定义ping() 方法。

model_handler.py 文件必须定义两个方法,像这样 -

custom_handler = CustomHandler()

# define your own health check for the model over here
def ping():
    return "healthy"


def handle(request, context): # context is necessary input otherwise Sagemaker will throw exception
    if request is None:
        return "SOME DEFAULT OUTPUT"
    try:
        response = custom_handler.predict_fn(request)
        return [response] # Response must be a list otherwise Sagemaker will throw exception

    except Exception as e:
        logger.error('Prediction failed for request: {}. \n'
                     .format(request) + 'Error trace :: {} \n'.format(str(e)))

您应该查看已接受的answer here 中的参考代码。

【讨论】:

    猜你喜欢
    • 2022-01-12
    • 1970-01-01
    • 2017-01-05
    • 2022-12-21
    • 1970-01-01
    • 1970-01-01
    • 2022-06-16
    • 1970-01-01
    • 2020-11-23
    相关资源
    最近更新 更多