
# 查询模型runtime
#### 功能介绍
查询模型AI引擎以及runtime。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ModelArts/doc?api=ShowModelEngineAndRuntime)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-modelarts/modelarts_03_0138.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
GET /v1/{project_id}/models/ai-engine-runtimes
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                            |
|:---|:---|:---|:---|
| project_id | 是    | String | 用户项目ID。获取方法请参见[获取项目ID](https://support.huaweicloud.com/api-modelarts/modelarts_03_0147.html)。 |
   
表2Query参数 
| 参数     | 是否必选 | 参数类型   | 描述                           |
|:---|:---|:---|:---|
| limit  | 否    | String | 每页显示的条目数量。                   |
| offset | 否    | String | 偏移量，表示从此偏移量开始查询，offset大于等于0。 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户token。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数              | 参数类型                                                                                                            | 描述                                            |
|:---|:---|:---|
| count           | Integer                                                                                                         | 不分页的情况下符合查询条件的总数量。                            |
| total_count     | Integer                                                                                                         | 当前查询结果的数量，不设置offset、limit查询参数时，count与total相同。 |
| engine_runtimes | Array of [EngineAndRuntimesResponse] objects | 引擎运行环境。                                       |
   
 表5EngineAndRuntimesResponse 
| 参数           | 参数类型                                                                                | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|
| ai_engine    | String                                                                              | AI引擎类型，目前共有以下几种类型： - TensorFlow   - PyTorch   - MindSpore   - XGBoost   - Scikit_Learn   - Spark_MLlib    |
| runtimes     | Array of strings                                                                    | 运行镜像，如pytorch_1.8.0-cuda_10.2-py_3.7-ubuntu_18.04-x86_64                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| request_mode | Array of strings                                                                    | 请求模式，AI引擎支持部署为同步在线服务或异步在线服务。 - sync：同步在线服务   - async：异步在线服务                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| accelerators | Array of [Accelerator] objects | AI引擎可使用的加速卡。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| arch         | Array of strings                                                                    | AI引擎架构，目前共两种： - x86_64   - aarch64                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| status_list  | Array of strings                                                                    | AI引擎状态，目前共三种： - normal (正常)   - deleted (已下线)   - deleting (下线中)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| image_source | Array of strings                                                                    | 镜像来源，目前共两种： - base_image (基础镜像)   - uniform_image (统一镜像)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
   
 表6Accelerator 
| 参数                     | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|
| type                   | String | 加速卡类型，目前共三种： - npu   - gpu   - none    |
| name                   | String | 加速卡名称，如SNT9B。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| cuda_version           | String | cuda驱动版本。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| driver_version_section | String | 驱动版本集合。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   
**状态码：401**
表7响应Body参数 
| 参数         | 参数类型   | 描述                                                                                   |
|:---|:---|:---|
| error_code | String | **参数解释**：ModelArts错误码。 **取值范围**：不涉及。 |
| error_msg  | String | **参数解释**：具体错误信息。 **取值范围**：不涉及。       |
   
**状态码：403**
表8响应Body参数 
| 参数         | 参数类型   | 描述                                                                                   |
|:---|:---|:---|
| error_code | String | **参数解释**：ModelArts错误码。 **取值范围**：不涉及。 |
| error_msg  | String | **参数解释**：具体错误信息。 **取值范围**：不涉及。       |
   
**状态码：404**
表9响应Body参数 
| 参数         | 参数类型   | 描述                                                                                   |
|:---|:---|:---|
| error_code | String | **参数解释**：ModelArts错误码。 **取值范围**：不涉及。 |
| error_msg  | String | **参数解释**：具体错误信息。 **取值范围**：不涉及。       |
   
#### 请求示例
```
GET https://{endpoint}/v1/{project_id}/models/ai-engine-runtimes
```
#### 响应示例
**状态码：200**
OK
```
{
  "count" : 4,
  "total_count" : 4,
  "engine_runtimes" : [ {
    "ai_engine" : "TensorFlow",
    "runtimes" : [ "tf1.13-python3.6-cpu", "tf1.13-python3.6-gpu", "tf1.13-python3.7-cpu", "tf1.13-python3.7-gpu", "python3.6", "tf1.13-python3.7-aiflow-gpu", "tf1.13-python3.7-gpu-async", "tensorflow_2.1.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64", "tensorflow_2.6.0-cuda_11.2-py_3.7-ubuntu_18.04-x86_64", "tensorflow_1.15.5-cuda_11.4-py_3.8-ubuntu_20.04-x86_64" ],
    "request_mode" : [ "sync", "sync", "sync", "sync", "sync", "sync", "async", "sync", "sync", "sync" ],
    "accelerators" : [ {
      "type" : "none"
    }, {
      "type" : "gpu",
      "cuda_version" : "cuda 10.2"
    }, {
      "type" : "none"
    }, {
      "type" : "gpu",
      "cuda_version" : "cuda 10.2"
    }, {
      "type" : "none"
    }, {
      "type" : "gpu",
      "cuda_version" : "cuda 10.2"
    }, {
      "type" : "gpu",
      "cuda_version" : "cuda 10.2"
    }, {
      "type" : "none"
    }, {
      "type" : "none"
    }, {
      "type" : "none"
    } ],
    "arch" : [ "x86_64", "x86_64", "x86_64", "x86_64", "x86_64", "x86_64", "x86_64", "x86_64", "x86_64", "x86_64" ],
    "status_list" : [ "normal", "normal", "normal", "normal", "normal", "normal", "normal", "normal", "normal", "normal" ],
    "image_source" : [ "base_image", "base_image", "base_image", "base_image", "base_image", "base_image", "base_image", "uniform_image", "uniform_image", "uniform_image" ]
  }, {
    "ai_engine" : "PyTorch",
    "runtimes" : [ "python3.6", "python3.7", "pytorch1.4-python3.7", "pytorch_1.11.0-cann_7.0.1-py_3.9-euler_2.10.7-aarch64-snt9b", "pytorch_1.8.0-cuda_10.2-py_3.7-ubuntu_18.04-x86_64", "pytorch_1.8.2-cuda_11.1-py_3.7-ubuntu_18.04-x86_64" ],
    "request_mode" : [ "sync", "sync", "sync", "sync", "sync", "sync" ],
    "accelerators" : [ {
      "type" : "none"
    }, {
      "type" : "none"
    }, {
      "type" : "none"
    }, {
      "type" : "npu",
      "name" : "SNT9",
      "driver_version_section" : "C8x"
    }, {
      "type" : "none"
    }, {
      "type" : "none"
    } ],
    "arch" : [ "x86_64", "x86_64", "x86_64", "aarch64", "x86_64", "x86_64" ],
    "status_list" : [ "normal", "normal", "normal", "normal", "normal", "normal" ],
    "image_source" : [ "base_image", "base_image", "base_image", "uniform_image", "uniform_image", "uniform_image" ]
  }, {
    "ai_engine" : "MindSpore",
    "runtimes" : [ "mindspore_1.9.0-cann_6.0.1-py_3.7-euler_2.9.9-x86_64-snt3p-300i", "mindspore_1.7.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64", "mindspore_1.2.0-py_3.7-cuda_10.1-ubuntu_18.04-x86_64" ],
    "request_mode" : [ "sync", "sync", "sync" ],
    "accelerators" : [ {
      "type" : "none"
    }, {
      "type" : "none"
    }, {
      "type" : "none"
    } ],
    "arch" : [ "x86_64", "x86_64", "x86_64" ],
    "status_list" : [ "normal", "normal", "normal" ],
    "image_source" : [ "uniform_image", "uniform_image", "uniform_image" ]
  }, {
    "ai_engine" : "Custom",
    "runtimes" : [ ],
    "request_mode" : [ ],
    "accelerators" : [ ],
    "arch" : [ ],
    "status_list" : [ ],
    "image_source" : [ ]
  } ]
}
```
#### 状态码
| 状态码 | 描述           |
|:---|:---|
| 200 | OK           |
| 401 | Unauthorized |
| 403 | Forbidden    |
| 404 | Not Found    |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-modelarts/modelarts_03_0095.html)。
