【发布时间】:2021-07-30 00:35:52
【问题描述】:
下面是 ECR Container 中的 predict.py 。 Sagemaker 端点在重试 10-12 分钟后给出“状态:失败”输出。 /ping 和 /invocations 方法都可用
/opt/ml/code/predict.py
----------
logger = logging.getLogger()
logger.setLevel(logging.INFO)
classpath = <.pkl file>
model = pickle.load(open(classpath, "rb"))
app = flask.Flask(__name__)
print(app)
@app.route("/ping", methods=["GET"]
def ping():
"""Determine if the container is working and healthy."""
return flask.Response(response="Flask running", status=200, mimetype="application/json")
@app.route("/invocations", methods=["POST"])
""InferenceCode""
return flask.Response(response="Invocation Completed", status=200,
mimetype="application/json")
Below snippet was both added and removed , however I still have the endpoint in failed status
if __name__ == '__main__':
app.run(host='0.0.0.0',port=5000)
Error :
"The primary container for production variant <modelname> did not pass the ping health check. Please check CloudWatch logs for this endpoint."
Sagemaker endpoint Cloudwatch logs.
[INFO] Starting gunicorn 20.1.0
[INFO] Listening at: http://0.0.0.0:8000 (1)
[INFO] Using worker: sync
[INFO] Booting worker with pid: 11```
【问题讨论】:
标签: python amazon-sagemaker amazon-ecr