You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何对Google Vertex Endpoint执行健康检查?

如何检查Vertex AI Endpoint的健康状态

目前Google Cloud Vertex AI的Python SDK确实没有提供直接的endpoint.health()方法,不过可以通过以下两种方式实现健康检查:

  • 发送测试预测请求
    如果Endpoint能正常处理预测请求,即可证明其处于健康状态。你可以构造一个符合模型输入格式的最小测试数据,调用endpoint.predict(),根据请求结果判断状态:
# 替换为你的模型接受的输入格式
test_instance = [{"feature1": 0, "feature2": 1}]

try:
    response = endpoint.predict(instances=test_instance)
    print("Endpoint健康,预测结果:", response.predictions)
except Exception as e:
    print("Endpoint异常:", str(e))
  • 检查Endpoint部署模型的状态
    通过endpoint.resource属性获取Endpoint的完整资源信息,查看部署模型的运行状态:
endpoint_resource = endpoint.resource

for deployed_model in endpoint_resource.deployed_models:
    model_id = deployed_model.id
    state = deployed_model.state
    print(f"部署模型 {model_id} 状态:{state}")
    if state == "RUNNING":
        print(f"模型 {model_id} 健康运行中")
    else:
        print(f"模型 {model_id} 状态异常")

以上两种方式足以覆盖大部分场景的健康检查需求。

内容的提问来源于stack exchange,提问作者CutePoison

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 15:37:37