作业管理

查询实时作业列表

1.接口说明

接口路径:/hpc/openapi/v2/jobs

请求方式:GET

请求数据类型:

接口描述:查询实时作业列表,结束的作业会在实时作业列表中继续存在5分钟

2.请求消息

请求参数:

Headers:

名称 类型 必填 描述 示例
tokenstring接口凭证eyJhbGciOiJIUzI1N...

参数:

名称 类型 必填 描述 示例
strClusterIDListlong调度器ID1638523853
strJobOwnerstring用户名test
strJobNamestring作业名称sleep
strJobIdstring作业ID1
startint起始坐标0
limitint请求一次获取数据的数目25
strQueueNamestring队列名称queuetest
strJobStatstring'statR(运行)','statQ(排队)','statH(保留)','statS(挂起)','statE(退出)','statC(完成)','statW(等待)','statX(其他)'statR

3.请求示例

cURL请求示例

curl --location 'https://api01.xxx.com:65106/hpc/openapi/v2/jobs?strClusterIDList=1638523853&strJobId=35919' \
--header 'Content-Type: application/json' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODU2MDAyMjU2MTUiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iLCKJ8PnDDK0_SA2NPYm1WozUG8D5ojwFqFhwaJCDc8'

Java请求示例

import okhttp3.*;

public class QueryJobListDemo {

    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/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请求示例

import requests
import json

url = "https://api01.xxx.com:65106/hpc/openapi/v2/jobs?strClusterIDList=1638523853&strJobId=35919"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODU2MDAyMjU2MTUiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iLCKJ8PnDDK0_SA2NPYm1WozUG8D5ojwFqFhwaJCDc8'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

4.响应消息

返回参数:

名称 类型 描述 示例
msgstring信息success
codestring状态码0
dataobject作业数据
totalint总计100
listarray每页数据
appTypestring应用fluent
errorPathstring错误输出路径/public/home/demo/00-HPC-CASE/FLUENT_1027_105403/std.err.104
jobIdstring作业ID12
jobNamestring作业名STDIN_1104_175546
jobRunTimestring作业已运行时长2-00:00:58
jobStartTimestring作业启动时间2021-11-04 17:55:49
jobStatusstring作业状态statR
jobVncSessionInfoVncSessionInfo作业VNC信息
archivestringVncViewer.jar文件VncViewer.jar
iClientNumberint连接该会话的客户端数0
iPixelDepthstring0
listClientsarray会话客户端地址列表
localestring编码方式zh_CN.UTF-8
loginPasswdstring会话登录密码d2fe93bf
mapSessionExtraAttrsmap其它会话属性
strAuthTypestring认证方式
strGeometrystring宽和高1280x1088
strJobManagerAddrstring会话所属区域的地址10.0.35.248
strJobManagerIDstring调度器ID1634819344
strJobManagerNamestring会话所属区域的名称Cluster
strRelateJobIDstring相关作业号110
strServerAddrstring会话所在主机的地址10.0.35.248
strServerNamestring会话所在主机的主机名node248
strSessionCTimestring会话创建时间2021-11-04 17:57:40
strSessionHeightstring会话高度1088
strSessionIDstring会话ID号1
strSessionOwnerstring会话所有者demo
strSessionTypestring会话类型
strSessionWidthstring会话宽度1280
vncCodestring.class文件com.tigervnc.vncviewer.VncViewer.class
jobmanagerIdstring调度器ID1634819344
jobmanagerNamestring调度器名称Cluster_node248
jobmanagerTypestring调度器类型SLURM
nodeUsedstring使用的节点node248
outputPathstring标准输出路径/public/home/demo/00-HPC-CASE/FLUENT_1027_105403/std.out.110
procNumUsedint使用的CPU个数2
queuestring队列debug
reasonstring原因
userstring用户demo
workDirstring工作路径/public/home/demo/00-HPC-CASE/FLUENT_1027_105403

返回示例:

{
    "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失败)

results matching ""

    No results matching ""