作业

查询历史作业列表

1.接口说明

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

请求方式:GET

请求数据类型:

接口描述:查询历史作业列表,返回用户历史作业的部分信息

2.请求消息

请求参数:

Headers:

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

参数:

名称 类型 必填 描述 示例
strClusterNameListstring集群ID1638523853
startTimestring开始时间2021-11-23 01:01:01
endTimestring结束时间2021-12-23 01:01:01
timeTypestringCUSTOMCUSTOM
queuestring队列名称debug
appTypestring应用名称fluent
sortstring排序规则DESC/ASC
orderBystring排序字段jobId
jobIdstring作业ID12
jobStatestring'statR(运行)','statQ(排队)','statH(保留)','statS(挂起)','statE(退出)','statC(完成)','statW(等待)','statX(其他)'statQ
hostNamestring节点名称h04r3n07
strUserstring用户名称test
jobNamestring作业名称STDIN_1208_173644
startint起始坐标0
limitint请求一次获取数据的数目25
isQueryByQueueTimeboolean按照结束时间查询false/按照入队时间查询true(推荐false)false

3.请求示例

cURL请求示例

curl --location 'https://api01.xxx.com:65106/hpc/openapi/v2/historyjobs?strClusterNameList=1638523853&strUser=test&timeType=CUSTOM&limit=20&isQueryByQueueTime=false&start=0&startTime=2023-01-01%2001%3A01%3A01&endTime=2023-12-12%2001%3A01%3A01%0A' \
--header 'Content-Type: application/json' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODU2MDAyMjU2MTUiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iLCKJ8PnDDK0_SA2NPYm1WozUG8D5ojwFqFhwaJCDc8'

Java请求示例

import okhttp3.*;

public class QueryHistoryJobListDemo {

    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/historyjobs?strClusterNameList=1638523853&strUser=test&timeType=CUSTOM&limit=20&isQueryByQueueTime=false&start=0&startTime=2023-01-01 01:01:01&endTime=2023-12-12 01:01:01 ")
                                .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/historyjobs?strClusterNameList=1638523853&strUser=test&timeType=CUSTOM&limit=20&isQueryByQueueTime=false&start=0&startTime=2023-01-01 01:01:01&endTime=2023-12-12 01:01:01"

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总条数true
listarray每页数据100
acctTimestring记账时间2021-11-04 17:57:42
appTypestring作业应用类型FLUENT
jobEndTimestring作业结束时间2021-11-04 17:57:42
jobExecHoststring作业执行节点node248
jobProcNumlong作业CPU核数1
jobExitStatuslong作业退出码0
jobIdstring作业id12
jobNamestring作业名FLUENT_1104_181054
jobQueueTimestring作业入队列时间2021-11-04 17:57:34
jobStartTimestring作业启动时间2021-11-04 17:57:34
jobStatestring作业状态statC
jobWalltimeUsedstring作业实际运行的Walltime,单位为秒8.0000
jobmanagerIdlong区域id1638523853
nodectstring分配的节点数1
queuestring队列名debug
userNamestring用户名demo
workdirstring工作空间/public/home/demo/00-HPC-CASE/FLUENT_1027_105403

返回示例:

{
    "code": "0",
    "msg": "success",
    "data": {
        "total": 17,
        "list": [
            {
                "acctTime": "2021-12-08 17:45:37",
                "jobId": "3",
                "jobmanagerId": 1638523853,
                "userName": "test",
                "jobName": "STDIN_1208_173644",
                "queue": "debug",
                "jobQueueTime": "2021-12-08 17:37:17",
                "jobStartTime": "2021-12-08 17:37:17",
                "jobExecHost": "h04r3n07",
                "nodect": 1,
                "jobEndTime": "2021-12-08 17:45:37",
                "jobWalltimeUsed": "500.0000",
                "workdir": "/home/test/BASE/STDIN_1208_173644",
                "appType": "BASE",
                "jobState": "statC",
                "jobExitStatus": 0,
                "jobProcNum": 1
            },
            {
                "acctTime": "2021-12-08 18:23:05",
                "jobId": "4",
                "jobmanagerId": 1638523853,
                "userName": "test",
                "jobName": "STDIN_1208_181428",
                "queue": "debug",
                "jobQueueTime": "2021-12-08 18:14:44",
                "jobStartTime": "2021-12-08 18:14:45",
                "jobExecHost": "h04r3n07",
                "nodect": 1,
                "jobEndTime": "2021-12-08 18:23:05",
                "jobWalltimeUsed": "500.0000",
                "workdir": "/home/test/BASE/STDIN_1208_181428",
                "appType": "BASE",
                "jobState": "statC",
                "jobExitStatus": 0,
                "jobProcNum": 1
            }
        ]
    }
}

5.错误码

错误码 说明
0 成功
10001 内部错误
10003 参数不全
10004 参数无效
10007 用户已被冻结
10008 权限不足
10009 没有权限访问接口
10010 文件校验失败
10011 文件过大
10012 连接中断
10013 操作超时
815005 作业提交失败(调度系统没返回)
815007 作业提交失败(调度系统sbatch失败)

results matching ""

    No results matching ""