容器
查询容器实例详情
1.接口说明
接口路径:/ai/openapi/v2/instance-service/{id}/detail
请求方式:GET
请求数据类型:
接口描述:查询容器实例详情
2.请求消息
请求参数:
Headers:
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1... |
参数:
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
id | string | 是 | 容器实例ID | 4c1f43ddb030483e89b55413bee6c004 |
3.请求示例
cURL请求示例
curl --location 'https://api01.xxx.com:65106/ai/openapi/v2/instance-service/4c1f43ddb030483e89b55413bee6c004/detail' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
Java请求示例
import okhttp3.*;
public class QueryContainerDetailDemo {
public static final String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODY5MDg1MDkyMzEiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.U7pZKgO_K6NuRwOWPxblDfgRpGeVxS-BYieOdLhGDK4";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api01.xxx.com:65106/ai/openapi/v2/instance-service/4c1f43ddb030483e89b55413bee6c004/detail")
.method("GET", null)
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Python请求示例
import requests
url = "https://api01.xxx.com:65106/ai/openapi/v2/instance-service/4c1f43ddb030483e89b55413bee6c004/detail"
payload = {}
headers = {
'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
4.响应消息
返回参数:
名称 | 类型 | 描述 | 示例 |
---|---|---|---|
msg | string | 信息 | 操作成功 |
code | string | 状态码 | 0 |
data | Object | 容器详情 | |
acceleratorType | string | 加速器类型 | |
taskType | string | 任务类型 | |
containerPortInfoList | array | 容器公开服务的端口信息集合 | |
accessUrl | string | 用户访问容器内服务的入口 | |
containerPort | string | 容器内已经开放的端口 | |
protocolType | string | 协议类型 | |
cpuNumber | int | CPU数量 | |
createTime | string | 创建时间 | |
currentIndex | int | 容器当前索引 | |
description | string | 描述信息 | |
duration | string | 持续时间 | |
endTime | string | 结束时间 | |
gpuNumber | int | GPU数量 | |
headerNotebookId | string | 容器实例关联的首个notebook任务ID | |
id | string | 容器实例ID | |
imagePath | string | 镜像路径 | |
instanceServiceName | string | 名称 | |
mountInfoList | array | 容器挂载信息集合 | |
sourcePath | string | 挂载路径 | |
type | string | 类型 | |
ramSize | int | 内存 | |
remainingTime | string | 剩余时间 | |
resourceGroup | string | 资源分组 | |
resourceSpec | string | 资源配置 | |
startScriptActionScope | string | 启用脚本范围 | |
startScriptPath | string | 启动脚本路径 | |
startScriptContent | string | 启动脚本的内容 | |
startTime | string | 开始时间 | |
status | string | 状态 | |
taskNumber | string | 实例任务数量 | |
tensorboardId | string | TB-ID | |
tensorboardPath | string | TB路径 | |
timeoutLimit | string | 超时时间 | |
useStartScript | boolean | 启用脚本 | |
userName | string | 用户名 | |
version | string | 镜像名称 |
返回示例:
{
"code": "0",
"msg": "SUCCESS",
"data": {
"id": "4c1f43ddb030483e89b55413bee6c004",
"headerNotebookId": "1a07f501dc89459686996a26ef521abb",
"instanceServiceName": "Instances_2205113837",
"currentIndex": 2,
"gpuNumber": 1,
"cpuNumber": 3,
"ramSize": 15360,
"acceleratorType": "gpu",
"resourceGroup": "TeslaM40",
"resourceSpec": "3 核心; 1 加速器; 15.0G 内存",
"taskNumber": 1,
"timeoutLimit": "unlimited",
"userName": "magic2",
"version": "jupyter:4.4-py3.7-cpu",
"imagePath": "10.0.35.26:5000/gpu/admin/base/jupyter:4.4-py3.7-cpu",
"status": "Waiting",
"taskType": "ssh",
"description": "",
"createTime": "2022-05-11 19:30:34",
"startTime": null,
"endTime": null,
"duration": "--",
"remainingTime": "--",
"tensorboardId": null,
"tensorboardPath": null,
"mountInfoList": [],
"containerPortInfoList": [],
"useStartScript": false,
"startScriptContent": "",
"startScriptPath": null,
"startScriptActionScope": "all",
"headerNotebookIp": null
}
}
5.错误码
错误码 | 说明 |
---|---|
0 | 成功 |
10001 | 内部异常(其他异常) |
10003 | 参数不全 |
10004 | 参数无效 |
10007 | 用户已被冻结 |
10008 | 权限不足 |
10009 | 没有权限访问接口 |
10010 | 文件校验失败 |
10011 | 文件过大 |
10012 | 连接中断 |