Notebook
查询Notebook实例列表
1.接口说明
接口路径:/ai/openapi/v2/notebook/list
请求方式:GET
请求数据类型:
接口描述:查询notebook实例列表
2.请求消息
请求参数:
Headers:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
参数:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| notebookName | string | 否 | notebook实例名称 | 2503021210191107 |
| notebookStatus | string | 否 | Notebook状态 | Creating("创建中"),Restarting("开机中"),Running( "运行中"),Terminated("已关机"),Failed( "失败"),Shutting( "关机中"); |
| size | int | 否 | 分页大小,默认20 | 20 |
| page | int | 否 | 分页,默认1 | 1 |
3.请求示例
cURL请求示例
shell
curl --location 'https://scnet-demo.accloud.cn/ai/openapi/v2/notebook/list' \
--header 'token: <Token>'Java请求示例
java
import okhttp3.*;
public class QueryNotebookListDemo {
public static final String TOKEN = "<Token>";
public static final String URL = "https://scnet-demo.accloud.cn/ai/openapi/v2/notebook/list";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url(URL)
.method("GET", null)
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}Python请求示例
python
import requests
url = "https://scnet-demo.accloud.cn/ai/openapi/v2/notebook/list"
payload = {}
headers = {
"token": "<Token>"
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)4.响应消息
返回参数:
| 名称 | 类型 | 描述 | 示例 |
|---|---|---|---|
| msg | string | 信息 | success |
| code | string | 状态码 | 0 |
| data | Object | ||
| total | int | 总数 | |
| records | array | notebook详情 | |
| id | string | notebook实例ID | |
| notebookName | string | notebook实例名称 | 2503021210191107 |
| notebookStatus | string | Notebook实例状态 | Creating("创建中"),Restarting("开机中"),Running( "运行中"),Terminated("已关机"),Failed( "失败"),Shutting( "关机中"); |
| imageName | string | 镜像名称 | jupyterlab-simplesdxl-webui:pytorch2.1.0-py3.10-dtk24.04-model |
| iamgePath | string | 镜像地址 | image.ac.com:5000/dcu/admin/base/jupyterlab-simplesdxl-webui:pytorch2.1.0-py3.10-dtk24.04-model |
| cpuNumber | string | cpu核心数 | 24核心 |
| acceleratorType | string | 加速器类型 | dcu |
| acceleratorNumber | int | 加速器数量 | 1 |
| resourceGroupCode | string | 资源分组code | hgk100_ainormal93b0dc03 |
| acceleratorMode | string | 加速器型号 | 异构加速卡AI |
| ramSize | string | 内存大小 | 110GB |
| imageSize | string | 镜像大小byte | 43726906378 |
| createTime | string | 创建时间 | 2025-03-02 12:10:20 |
| releaseTime | string | 释放时间 | 28天20小时17分钟 |
| updateTime | string | 更新时间 | 2025-03-02 12:10:51 |
| progress | number | 部署进度 | null |
| startType | string | 启动方式 | normal |
| maxTimeout | string | 最大超时时间 | null |
| sshPassword | string | ssh密码 | 9pM28jD7606121T |
| serviceIp | string | 服务ip | 10.68.206.205 |
| sshUrl | string | ssh地址 | null |
| taskId | string | 任务ID | 1896050410558525441 |
| enoughResource | boolean | 资源是否充足 | true |
| containerId | string | 容器ID | 17b8dac2c249c6552394194c42e5791a0c8fab6c70506562d90a95e17cebb0c1 |
| resourceGroupId | string | 资源分组ID | 15 |
| containerType | string | 容器类型 | null |
| maxNumber | int | 最大卡数 | 8 |
| freeNumber | int | 空闲卡数 | 5 |
| node | string | 节点 | 10.13.1.15 |
| command | string | 自定义服务启动命令 | python /root/SimpleSDXL/entry_with_update.py --listen 0.0.0.0 --port 1223 > /root/sd.log 2>&1 |
| customsizePort | string | 自定义服务监听端口 | 1223 |
| errorMessage | string | 失败信息 | |
| message | string | 失败描述信息 |
返回示例:
json
{
"code": "0",
"msg": "success",
"data": {
"id": "1896050410550136833",
"notebookName": "2503021210191107",
"notebookStatus": "Terminated",
"imageName": "jupyterlab-simplesdxl-webui:pytorch2.1.0-py3.10-dtk24.04-model",
"imagePath": "image.ac.com:5000/dcu/admin/base/jupyterlab-simplesdxl-webui:pytorch2.1.0-py3.10-dtk24.04-model",
"cpuNumber": "24核心",
"acceleratorType": "dcu",
"acceleratorNumber": 1,
"resourceGroupCode": "hgk100_ainormal93b0dc03",
"acceleratorMode": "异构加速卡AI",
"ramSize": "110GB",
"imageSize": "43726906378",
"createTime": "2025-03-02 12:10:20",
"releaseTime": "28天20小时17分钟",
"updateTime": "2025-03-02 12:10:51",
"progress": null,
"startType": "normal",
"maxTimeout": null,
"sshPassword": "9pM28jD7606121T",
"serviceIp": "10.68.206.205",
"serviceUrl": null,
"sshUrl": null,
"taskId": "1896050410558525441",
"enoughResource": true,
"containerId": null,
"resourceGroupId": "15",
"containerType": null,
"node": "10.13.1.15",
"message": null,
"errorMessage": null,
"maxNumber": 8,
"freeNumber": 5,
"command": "python /root/SimpleSDXL/entry_with_update.py --listen 0.0.0.0 --port 1223 > /root/sd.log 2>&1",
"customizePort": "1223"
}
}5.错误码
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 10001 | 内部错误 |
| 10003 | 参数不全 |
| 10004 | 参数无效 |
| 10007 | 用户已被冻结 |
| 10008 | 权限不足 |
| 10009 | 没有权限访问接口 |
| 10010 | 文件校验失败 |
| 10011 | 文件过大 |
| 10012 | 连接中断 |