更新时间:2024-03-21 GMT+08:00
分享

查询服务详情

功能介绍

查询模型服务详情,根据服务ID查询服务详情。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v1/{project_id}/services/{service_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

用户项目ID。获取方法请参见获取项目ID和名称

service_id

String

服务ID。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

service_id

String

服务ID。

service_name

String

服务名称。

description

String

服务描述。

tenant

String

服务归属租户。

project

String

服务归属项目。

owner

String

服务归属用户。

publish_at

Number

服务最新的发布时间,距“1970.1.1 0:0:0 UTC”的毫秒数。

infer_type

String

推理方式,取值包含:

  • real-time:在线服务

  • batch:批量服务

  • edge: 边缘服务

workspace_id

String

工作空间ID。

cluster_id

String

在线/批量服务使用的专属资源池ID,仅当配置专属资源池时返回。

vpc_id

String

在线服务实例所在的虚拟私有云ID,服务自定义网络配置时返回。

subnet_network_id

String

在线服务实例所在的子网的网络ID,服务自定义网络配置时返回。

security_group_id

String

在线服务实例所在的安全组,服务自定义网络配置时返回。

status

String

服务状态,取值包含:

  • running:运行中,服务正常运行。

  • deploying:部署中,服务正在部署,包含打镜像和调度资源部署。

  • concerning:告警,后端实例部分存在异常。

  • failed:失败,服务部署失败,失败原因可以看事件和日志标签页。

  • stopped:停止。

  • finished:只有批量服务会有这个状态,表示运行完成。

  • stopping: 停止中。

  • deleting: 删除中。

  • pending: 待启动,仅在线有这个状态。

  • waiting: 资源排队中,仅在线服务有这个状态

progress

Integer

部署进度,当状态是deploying时返回。

error_msg

String

错误信息,当status为failed时,返回这个信息注明失败原因。

config

Array of QueryServiceConfig objects

服务配置(如果是共享过来的服务,只返回model_id ,model_name, model_version)。

access_address

String

推理请求的访问地址,当infer_type为real-time时会返回此值。

bind_access_address

String

自定义域名的推理请求地址,绑定域名后会返回此值。

invocation_times

Number

服务的总调用次数。

failed_times

Number

服务调用失败次数。

is_shared

Boolean

是否是订阅的服务。

shared_count

Number

订阅的服务数。

schedule

Array of Schedule objects

服务调度配置,未配置则不返回。

update_time

Number

服务当前运行所用配置的更新时间,距“1970.1.1 0:0:0 UTC”的毫秒数。

debug_url

String

在线服务在线调试地址,只有当模型支持在线调试且只有一个实例的时候会存在。

due_time

Number

在线服务自动停止时间,距“1970.1.1 0:0:0 UTC”的毫秒数,未配置自动停止则不返回。

operation_time

Number

当前请求的操作时间。

transition_at

Number

服务状态转化时间。

is_free

Boolean

服务是否是免费规格类型。

additional_properties

Map<String,String>

服务附加属性。

pool_name

String

新版专属资源池ID,默认为空,不使用专属资源池;对应新版资源池的资源池ID。

表4 QueryServiceConfig

参数

参数类型

描述

model_version

String

模型版本。

finished_time

Number

任务完成时间,距“1970.1.1 0:0:0 UTC”的毫秒数;任务未结束时不返回。

custom_spec

CustomSpec object

自定义资源规格配置。

envs

Map<String,String>

运行模型需要的环境变量键值对。

specification

String

资源规格,取值为modelarts.vm.cpu.2u/modelarts.vm.gpu.p4/modelarts.vm.ai1.a310/custom。

weight

Integer

权重,分配到此模型的流量权重。

source_type

String

模型来源,当模型是由自动学习产生时返回此字段,取值为auto。

model_id

String

模型ID。

src_path

String

批量任务输入数据的OBS路径。

req_uri

String

批量任务中调用的推理路径。

mapping_type

String

输入数据的映射类型,取值为file或csv。

start_time

Number

任务启动时间,距“1970.1.1 0:0:0 UTC”的毫秒数;任务未开始时不返回。

cluster_id

String

服务实例使用的专属资源池ID,仅当配置专属资源池时返回。

nodes

Array of Nodes objects

节点信息。

mapping_rule

Object

输入参数与csv数据的映射关系,仅当mapping_type为csv时会返回。

model_name

String

模型名称。

src_type

String

数据来源类型,仅当指定为ManifestFile时返回。

dest_path

String

批量任务输出结果的OBS路径。

instance_count

Integer

模型部署的实例数。

status

String

服务状态,取值包含:

  • running:运行中,服务正常运行。

  • deploying:部署中,服务正在部署,包含打镜像和调度资源部署。

  • concerning:告警,后端实例部分存在异常。

  • failed:失败,服务部署失败,失败原因可以看事件和日志标签页。

  • stopped:停止。

  • finished:只有批量服务会有这个状态,表示运行完成。

scaling

Boolean

是否启用弹性伸缩。

support_debug

Boolean

模型是否支持在线调试。

additional_properties

Map<String,String>

模型部署附加属性。

pool_name

String

新版专属资源池ID,默认为空,不使用专属资源池;对应新版资源池的资源池ID。

表5 CustomSpec

参数

参数类型

描述

gpu_p4

Float

GPU个数,可选,默认不使用,支持配置小数,输入值不能小于0(最多支持2位小数,小数点后第3位做四舍五入处理)。

memory

Integer

内存,单位为MB,仅支持整数。

cpu

Float

CPU核数,支持配置小数,输入值不能小于0.01(最多支持2位小数,小数点后第3位做四舍五入处理)。

ascend_a310

Integer

Ascend芯片个数,可选,默认不使用,不支持与gpu_p4同时配置。

表6 Nodes

参数

参数类型

描述

memory

Integer

内存数(MB)。

os_version

String

节点操作系统版本。

cpu

Integer

CPU核心数。

created_at

String

创建时间,格式为YYYY-MM-DDThh:mm:ss,UTC时间。

description

String

描述。

message

String

当 instance_status 为failed或者是notReady时,解释原因。

predict_url

String

在该节点的预测URL。

enable_gpu

Boolean

是否开启GPU。

gpu_num

Integer

gpu个数。

host_ips

Array of strings

节点主机IP。

updated_at

String

更新时间,格式为YYYY-MM-DDThh:mm:ss,UTC时间。

node_label

String

节点标签。

os_type

String

节点操作系统类型。

name

String

边缘节点名称。

os_name

String

节点操作系统名称。

arch

String

节点架构。

id

String

边缘节点ID。

instance_status

String

模型实例在该节点的运行状态,取值为running/stopped/notReady/failed。

state

String

主机状态,取值为RUNNING/FAIL/UNCONNECTED,表示运行中/故障/未连接。

deployment_num

Integer

部署在该节点上的应用实例个数。

host_name

String

节点主机名。

表7 Schedule

参数

参数类型

描述

duration

Integer

对应时间单位的数值,比如2小时后停止,则time_unit填HOURS,duration填2。

time_unit

String

调度时间单位,可选DAYS/HOURS/MINUTES。

type

String

调度类型,当前仅支持取值为stop。

请求示例

GET https://{endpoint}/v1/{project_id}/services/{service_id}

响应示例

状态码: 200

服务详情

{
  "service_id" : "f76f20ba-78f5-44e8-893a-37c8c600c02f",
  "service_name" : "service-demo",
  "tenant" : "xxxxx",
  "project" : "xxxxx",
  "owner" : "xxxxx",
  "publish_at" : 1585809231902,
  "update_time" : 1585809358259,
  "infer_type" : "real-time",
  "status" : "running",
  "progress" : 100,
  "access_address" : "https://xxxxx.apigw.xxxxx.com/v1/infers/088458d9-5755-4110-97d8-1d21065ea10b/f76f20ba-78f5-44e8-893a-37c8c600c02f",
  "cluster_id" : "088458d9-5755-4110-97d8-1d21065ea10b",
  "workspace_id" : "0",
  "additional_properties" : { },
  "is_shared" : false,
  "invocation_times" : 0,
  "failed_times" : 0,
  "shared_count" : 0,
  "operation_time" : 1586249085447,
  "config" : [ {
    "model_id" : "044ebf3d-8bf4-48df-bf40-bad0e664c1e2",
    "model_name" : "jar-model",
    "model_version" : "1.0.1",
    "specification" : "custom",
    "custom_spec" : { },
    "status" : "notReady",
    "weight" : 100,
    "instance_count" : 1,
    "scaling" : false,
    "envs" : { },
    "additional_properties" : { },
    "support_debug" : false
  } ],
  "transition_at" : 1585809231902,
  "is_free" : false
}

状态码

状态码

描述

200

服务详情

错误码

请参见错误码

分享:

    相关文档

    相关产品