创建资源组模板(CreateResourceTemplate)
基本信息
Action:/qai/aicp/resource/template
Method: POST
Content-Type:application/json
请求参数
参数 | 类型 | 描述 | 是否必须 |
---|---|---|---|
name |
string |
资源节点名称。 |
yes |
cpu |
number |
CPU 核心数。 |
yes |
memory |
number |
内存大小。 |
yes |
gpu |
number |
GPU 数量。 |
yes |
gpu_memory |
number |
GPU 显存大小。 |
yes |
rg_id |
string |
资源组 ID。 |
yes |
ib |
number |
InfiniBand 支持状态。 |
yes |
rg_node_id |
string |
资源节点 ID。 |
yes |
pod_type |
array |
支持的 Pod 类型列表。 |
yes |
gpu_list |
array<string> |
GPU 设备 ID 列表。 |
yes |
gpu_name |
string |
GPU 型号名称。 |
yes |
show_user |
array<string> |
有权限查看该资源的用户 ID 列表。 |
yes |
hashrate_allocation |
number |
算力分配比例。 |
yes |
data_disk_size |
number |
数据磁盘大小。 |
yes |
cpu_manufacturer |
string |
CPU 制造商。 |
yes |
cpu_model |
string |
CPU 具体型号。 |
yes |
spec_type |
string |
资源规格类型,可输入 |
yes |
响应参数
此接口包含公共响应参数,可参见前文内容,其它参数如下:
参数 | 类型 | 描述 |
---|---|---|
tmp_ids |
array |
新创建的资源组模板 ID。 |
data.resource_group.status |
string |
资源组状态(active/inactive等) |
data.resource_group.user_id |
string |
所属用户 ID |
data.resource_group.name |
string |
资源组名称 |
data.resource_group.rg_id |
string |
资源组唯一标识 |
data.resource_group.created_at |
string |
创建时间 |
data.resource_group.root_user_id |
string |
主账户 ID |
data.resource_group.updated_at |
string |
最后更新时间 |
data.resource_group.customize_enable |
integer |
自定义功能开关(1启用/0禁用) |
data.resource_group.reason |
null |
状态变更原因 |
data.resource_group.pod_type |
string |
支持的 Pod 类型(逗号分隔) |
data.resource_group.resource_type |
string |
资源类型标识 |
data.resource_group.description |
string |
资源组描述 |
data.max_applicable_number |
integer |
最大可申请数量 |
data.gpu_list |
null |
GPU 设备列表(未配置时为null) |
data.pod_type |
array<string> |
支持的任务类型集合 |
data.ib |
integer |
InfiniBand 网卡数量 |
data.gpu_memory |
integer |
单卡显存容量(GB) |
data.salable |
boolean |
是否可售状态 |
data.memory |
integer |
内存容量(GB) |
data.gpu |
integer |
GPU卡 数量 |
data.rg_id |
string |
资源组 ID |
data.cpu_model |
null |
CPU 型号(未配置时为null) |
data.show_user |
null |
可见用户白名单 |
data.gpu_name |
null |
GPU 型号名称 |
data.name |
string |
规格名称 |
data.rg_node_name |
null |
资源节点名称 |
data.data_disk_size |
integer |
数据磁盘容量(GB) |
data.hashrate_allocation |
integer |
算力分配比例 |
data.rg_node_id |
string |
资源节点 ID |
data.spec_type |
string |
规格类型,common、share_gpu、vgpu 或 only_cpu |
data.cpu_manufacturer |
null |
CPU 制造商 |
data.cpu |
integer |
CPU 核心数 |
data.show_users_info |
null |
用户可见性详情 |
请求示例
curl -X 'POST' \
'https://ai.coreshub.cn/qai/aicp/resource/template' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"data": [
{
"name": "",
"cpu": 0,
"memory": 0,
"gpu": 0,
"gpu_memory": 0,
"rg_id": "string",
"ib": 0,
"rg_node_id": "",
"pod_type": [
"job"
],
"gpu_list": [
"string"
],
"gpu_name": "string",
"show_user": [
"string"
],
"hashrate_allocation": 0,
"data_disk_size": 0,
"cpu_manufacturer": "string",
"cpu_model": "string",
"spec_type": "only_cpu"
}
]
}'
响应示例
{
"message": "success",
"meta": {
"X_REQUEST_ID": "255b09b0",
"X_REQUEST_USER": "usr-5HY8cBJF"
},
"data": [
{
"tmp_id": 55,
"resource_group": {
"status": "active",
"user_id": "usr-5HY8cBJF",
"name": "docs011",
"rg_id": "rg-gk164yq9",
"created_at": "2025-04-15T10:19:24",
"root_user_id": "usr-5HY8cBJF",
"updated_at": "2025-04-15T10:51:57",
"customize_enable": 1,
"reason": null,
"pod_type": "infer,instance",
"resource_type": "",
"description": ""
},
"max_applicable_number": 0,
"gpu_list": null,
"pod_type": [
"instance"
],
"ib": 0,
"gpu_memory": 0,
"salable": false,
"memory": 2,
"gpu": 0,
"rg_id": "rg-gk164yq9",
"cpu_model": null,
"show_user": null,
"gpu_name": null,
"name": "spec01",
"rg_node_name": null,
"data_disk_size": 0,
"hashrate_allocation": 0,
"rg_node_id": "",
"spec_type": "only_cpu",
"cpu_manufacturer": null,
"cpu": 1,
"show_users_info": null
}
],
"counts": 1,
"ret_code": 0
}