Skip to content

作业

查询集群信息

1.接口说明

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

请求方式:GET

请求数据类型:

接口描述:查询集群信息,获取到的ID号即为后续作业接口需要使用的调度器ID,获取到的text为后续作业接口需要使用的集群名称

2.请求消息

请求参数:

Headers:

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

3.请求示例

cURL请求示例

shell
curl --location 'https://scnet-demo.accloud.cn/hpc/openapi/v2/cluster' \
--header 'Content-Type: application/json' \
--header 'token: <Token>'

Java请求示例

java
import okhttp3.*;

public class QueryClusterInfoDemo {
    
    public static final String URL = "https://scnet-demo.accloud.cn/hpc/openapi/v2/cluster";
    
    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(URL)
                .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/cluster"
payload = {}
headers = {
  "Content-Type": "application/json",
  "token": "<Token>"
}

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

4.响应消息

返回参数:

名称类型描述示例
msgstring信息success
codestring状态码0
dataarray区域基本信息
JobManagerTypestring区域调度器类型SLURM
JobManagerAddrstring区域地址10.8.150.45
idlong调度器ID1638523853
textstring区域名称Cluster
JobManagerPortstring区域端口9091

返回示例:

json
{
  "code":"0",
  "msg":"success",
  "data":[
    {
      "JobManagerAddr":"10.0.150.45",
      "JobManagerType":"SLURM",
      "id":1638523853,
      "text":"Cluster",
      "JobManagerPort":"9091"
    }
  ]
}

5.错误码

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