作业管理
查询实时作业列表
1.接口说明
接口路径:/hpc/openapi/v2/jobs
请求方式:GET
请求数据类型:
接口描述:查询实时作业列表,结束的作业会在实时作业列表中继续存在5分钟
2.请求消息
请求参数:
Headers:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
参数:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| strClusterIDList | long | 是 | 调度器ID | 1638523853 |
| strJobOwner | string | 否 | 用户名 | test |
| strJobName | string | 否 | 作业名称 | sleep |
| strJobId | string | 否 | 作业ID | 1 |
| start | int | 否 | 起始坐标 | 0 |
| limit | int | 否 | 请求一次获取数据的数目 | 25 |
| strQueueName | string | 否 | 队列名称 | queuetest |
| strJobStat | string | 否 | 'statR(运行)','statQ(排队)','statH(保留)','statS(挂起)','statE(退出)','statC(完成)','statW(等待)','statX(其他)' | statR |
3.请求示例
cURL请求示例
shell
curl --location 'https://scnet-demo.accloud.cn/hpc/openapi/v2/jobs?strClusterIDList=1638523853&strJobId=35919' \
--header 'Content-Type: application/json' \
--header 'token: <Token>'Java请求示例
java
import okhttp3.*;
public class QueryJobListDemo {
public static final String TOKEN = "<Token>";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://scnet-demo.accloud.cn/hpc/openapi/v2/jobs?strClusterIDList=1638523853&strJobId=35919")
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}Python请求示例
python
import requests
import json
url = "https://scnet-demo.accloud.cn/hpc/openapi/v2/jobs?strClusterIDList=1638523853&strJobId=35919"
payload = {}
headers = {
"Content-Type": "application/json",
"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 | 总计 | 100 |
| list | array | 每页数据 | |
| appType | string | 应用 | fluent |
| errorPath | string | 错误输出路径 | /public/home/demo/00-HPC-CASE/FLUENT_1027_105403/std.err.104 |
| jobId | string | 作业ID | 12 |
| jobName | string | 作业名 | STDIN_1104_175546 |
| jobRunTime | string | 作业已运行时长 | 2-00:00:58 |
| jobStartTime | string | 作业启动时间 | 2021-11-04 17:55:49 |
| jobStatus | string | 作业状态 | statR |
| jobVncSessionInfo | VncSessionInfo | 作业VNC信息 | |
| archive | string | VncViewer.jar文件 | VncViewer.jar |
| iClientNumber | int | 连接该会话的客户端数 | 0 |
| iPixelDepth | string | 0 | |
| listClients | array | 会话客户端地址列表 | |
| locale | string | 编码方式 | zh_CN.UTF-8 |
| loginPasswd | string | 会话登录密码 | d2fe93bf |
| mapSessionExtraAttrs | map | 其它会话属性 | |
| strAuthType | string | 认证方式 | |
| strGeometry | string | 宽和高 | 1280x1088 |
| strJobManagerAddr | string | 会话所属区域的地址 | 10.0.35.248 |
| strJobManagerID | string | 调度器ID | 1634819344 |
| strJobManagerName | string | 会话所属区域的名称 | Cluster |
| strRelateJobID | string | 相关作业号 | 110 |
| strServerAddr | string | 会话所在主机的地址 | 10.0.35.248 |
| strServerName | string | 会话所在主机的主机名 | node248 |
| strSessionCTime | string | 会话创建时间 | 2021-11-04 17:57:40 |
| strSessionHeight | string | 会话高度 | 1088 |
| strSessionID | string | 会话ID号 | 1 |
| strSessionOwner | string | 会话所有者 | demo |
| strSessionType | string | 会话类型 | |
| strSessionWidth | string | 会话宽度 | 1280 |
| vncCode | string | .class文件 | com.tigervnc.vncviewer.VncViewer.class |
| jobmanagerId | string | 调度器ID | 1634819344 |
| jobmanagerName | string | 调度器名称 | Cluster_node248 |
| jobmanagerType | string | 调度器类型 | SLURM |
| nodeUsed | string | 使用的节点 | node248 |
| outputPath | string | 标准输出路径 | /public/home/demo/00-HPC-CASE/FLUENT_1027_105403/std.out.110 |
| procNumUsed | int | 使用的CPU个数 | 2 |
| queue | string | 队列 | debug |
| reason | string | 原因 | |
| user | string | 用户 | demo |
| workDir | string | 工作路径 | /public/home/demo/00-HPC-CASE/FLUENT_1027_105403 |
返回示例:
json
{
"code":"0",
"msg":"success",
"data":{
"total":2,
"list":[
{
"jobId":"27",
"jobName":"STDIN_0910_094758",
"jobStatus":"statC",
"queue":"debug",
"user":"test",
"nodeUsed":"h04r3n07",
"procNumUsed":1,
"jobStartTime":"2021-12-10 16:11:30",
"jobRunTime":"00:00:05",
"jobVncSessionInfo":null,
"jobmanagerId":"1638523853",
"jobmanagerName":"Cluster",
"jobmanagerType":"SLURM",
"errorPath":"/public/home/test/BASE/STDIN_1210_114429/std.err.27",
"outputPath":"/public/home/test/BASE/STDIN_1210_114429/std.out.27",
"workDir":"/public/home/test/BASE/STDIN_1210_114429",
"reason":null,
"appType":"BASE"
},
{
"jobId":"23",
"jobName":"STDIN_0910_094758",
"jobStatus":"statR",
"queue":"debug",
"user":"test",
"nodeUsed":"h04r3n07",
"procNumUsed":1,
"jobStartTime":"2021-12-10 15:10:17",
"jobRunTime":"01:02:20",
"jobVncSessionInfo":null,
"jobmanagerId":"1638523853",
"jobmanagerName":"Cluster",
"jobmanagerType":"SLURM",
"errorPath":"/public/home/test/BASE/STDIN_1210_114429/std.err.23",
"outputPath":"/public/home/test/BASE/STDIN_1210_114429/std.out.23",
"workDir":"/public/home/test/BASE/STDIN_1210_114429",
"reason":null,
"appType":"BASE"
}
]
}
}5.错误码
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 10001 | 内部错误 |
| 10003 | 参数不全 |
| 10004 | 参数无效 |
| 10007 | 用户已被冻结 |
| 10008 | 权限不足 |
| 10009 | 没有权限访问接口 |
| 10010 | 文件校验失败 |
| 10011 | 文件过大 |
| 10012 | 连接中断 |
| 10013 | 操作超时 |
| 815005 | 作业提交失败(调度系统没返回) |
| 815007 | 作业提交失败(调度系统sbatch失败) |