API请求
URLs
PUT zstack/v1/ai/model-servicesHeaders
Authorization: OAuth the-session-uuidBody
{
"deployDistributedModelService": {
"modelServices": [
{
"isInitialNode": false,
"uuid": "f1e135835fee363c9f57ed8232023886",
"zoneUuid": "7a007a391d483c9f843bf1df4b7e5d8f",
"cpuNum": 8,
"name": "model-service",
"type": "VirtualMachine",
"memorySize": 17179869184,
"timeout": 0
}
],
"serviceCreationStrategy": "parallel",
"name": "distributed-model-service"
},
"systemTags": [],
"userTags": []
}说明: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"deployDistributedModelService":{"modelServices":[{"isInitialNode":false,"uuid":"f1e135835fee363c9f57ed8232023886","zoneUuid":"7a007a391d483c9f843bf1df4b7e5d8f","cpuNum":8,"name":"model-service","type":"VirtualMachine","memorySize":17179869184,"timeout":0}],"serviceCreationStrategy":"parallel","name":"distributed-model-service"}}' \
http://localhost:8080/zstack/v1/ai/model-services参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| modelServices | List | body(包含在deployDistributedModelService结构中) | 模型服务部署信息 | 5.3.22 | |
| serviceCreationStrategy | String | body(包含在deployDistributedModelService结构中) | 服务创建策略 |
|
5.3.22 |
| name | String | body(包含在deployDistributedModelService结构中) | 资源名称 | 5.3.22 | |
| description (可选) | String | body(包含在deployDistributedModelService结构中) | 资源的详细描述 | 5.3.22 | |
| systemTags (可选) | List | body | 系统标签 | 5.3.22 | |
| userTags (可选) | List | body | 用户标签 | 5.3.22 | |
| resourceUuid (可选) | String | body(包含在deployDistributedModelService结构中) | 资源UUID | 5.3.46 | |
| tagUuids (可选) | List | body(包含在deployDistributedModelService结构中) | 标签UUID列表 | 5.3.46 |
API返回
返回示例
{
"inventory": {
"uuid": "groupUuid",
"name": "distributed-model-service",
"status": "Running"
}
}返回字段
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | Boolean | 操作是否成功 | 5.1.8 |
| error | ErrorCode | 错误码,操作成功时该字段为null | 5.1.8 |
| inventory | ModelServiceInstanceGroupInventory | 模型服务实例组清单 | 5.1.8 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标识该资源 | 5.1.8 |
| modelServiceUuid | String | 模型服务UUID | 5.1.8 |
| modelUuid | String | 模型UUID | 5.1.8 |
| instances | List | 模型服务实例列表 | 5.1.8 |
| datasetRefInventories | List | 数据集引用列表 | 5.1.8 |
| status | String | 实例组状态 | 5.1.8 |
| modelServiceType | String | 模型服务类型 | 5.1.8 |
| type | String | 实例组类型 | 5.1.8 |
| name | String | 实例组名称 | 5.1.8 |
| description | String | 实例组描述 | 5.1.8 |
| yaml | String | YAML配置 | 5.1.8 |
| supportMetrics | List | 支持的指标列表 | 5.1.8 |
| exportPath | String | 导出路径 | 5.1.8 |
| createDate | Timestamp | 创建时间 | 5.1.8 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.1.8 |
SDK示例
Java
SDK
DeployDistributedModelServiceAction action = new DeployDistributedModelServiceAction();
action.modelServices = asList([isInitialNode:false, uuid:f1e135835fee363c9f57ed8232023886, zoneUuid:7a007a391d483c9f843bf1df4b7e5d8f, cpuNum:8, name:model-service, type:VirtualMachine, memorySize:17179869184, timeout:0]);
action.serviceCreationStrategy = "parallel";
action.name = "distributed-model-service";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeployDistributedModelServiceAction.Result res = action.call();Python
SDK
DeployDistributedModelServiceAction action = DeployDistributedModelServiceAction()
action.modelServices = [[isInitialNode:false, uuid:f1e135835fee363c9f57ed8232023886, zoneUuid:7a007a391d483c9f843bf1df4b7e5d8f, cpuNum:8, name:model-service, type:VirtualMachine, memorySize:17179869184, timeout:0]]
action.serviceCreationStrategy = "parallel"
action.name = "distributed-model-service"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeployDistributedModelServiceAction.Result res = action.call()