矩池云开放API
  1. PaaS API
矩池云开放API
  • PaaS API
    • 新增任务
      POST
    • 查询单个任务详情
      GET
    • 查询所有任务状态
      GET
    • 查询所有任务详情
      GET
    • 取消任务
      DELETE
  1. PaaS API

查询单个任务详情

GET
https://paas.matpool.com/v1/job
该接口用于获取单个任务的具体信息,返回的数据 schema 和创建任务接口的返回是一致的,但是不管是创建任务接口还是获取任务信息,返回的都是响应的时候任务的当前信息,所以可以轮询请求该接口来跟进任务的状态变化。

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Query 参数
id
string 
必需
任务ID,此ID是PaaS API接口返回的ID,非我的任务界面展示的ID
示例值:
{{job_id}}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location -g --request GET 'https://paas.matpool.com/v1/job?id={{job_id}}'

返回响应

🟢200成功
application/json
Body
code
integer 
错误码
必需
msg
string 
错误消息
必需
job
object 
任务信息
必需
id
integer 
任务ID
必需
仅可在 PaaS API 中使用
ctx
object 
必需
state
object 
任务状态变更历史
必需
状态&变更时间
status
integer 
任务当前状态
必需
1:排队中:检查配置信息并等待资源分配,机器资源不足,账户余额不足,镜像/环境不存在或者权限不足等情况都会导致任务长期处于此状态
2:已调度:已经分配资源,正在配置实例中
3:运行中(计费状态)
4:已完成
5:取消中
6:初始化中
app
object 
应用层信息
必需
res
object 
实例信息
必需
createTime
object 
必需
vols
null 
必需
queueLen
integer 
必需
nets
array[string]
必需
displayID
string 
任务ID
必需
展示在我的任务界面的ID,可用于界面上的任务查询
autoRelease
boolean 
必需
releaseTime
null 
必需
updateTime
null 
必需
desc
string 
必需
示例
{
    "code": 0,
    "msg": "",
    "job": {
        "id": 421136,
        "ctx": {
            "ownerId": 724,
            "nodeId": 1698381,
            "clientID": 10001,
            "nodeDisplayID": "Zkj4Qm",
            "class": "",
            "aotuRelease": false,
            "releaseTime": null,
            "nodeDomain": 0
        },
        "state": {
            "status": 3,
            "log": [
                {
                    "id": 2498421,
                    "status": 6,
                    "ts": {
                        "seconds": 1744020679
                    },
                    "sourceId": 421136
                },
                {
                    "id": 2498422,
                    "status": 1,
                    "ts": {
                        "seconds": 1744020679
                    },
                    "sourceId": 421136
                },
                {
                    "id": 2498424,
                    "status": 2,
                    "ts": {
                        "seconds": 1744020703
                    },
                    "sourceId": 421136
                },
                {
                    "id": 2498425,
                    "status": 3,
                    "ts": {
                        "seconds": 1744020724
                    },
                    "sourceId": 421136
                }
            ]
        },
        "status": 3,
        "app": {
            "name": "",
            "ver": "",
            "envs": "model_code=3;env=hello",
            "format": 2,
            "files": null,
            "cmd": "tail -f /dev/null",
            "hostname": "",
            "creds": "",
            "ports": [
                {
                    "port": 22,
                    "protocol": 1,
                    "extraData": null
                },
                {
                    "port": 8888,
                    "protocol": 2,
                    "extraData": null
                },
                {
                    "port": 8989,
                    "protocol": 1,
                    "extraData": null
                },
                {
                    "port": 8895,
                    "protocol": 2,
                    "extraData": null
                }
            ],
            "urls": {
                "port_22": {
                    "urls": [
                        "ssh://hz-t3.matpool.com:29507"
                    ]
                },
                "port_8888": {
                    "urls": [
                        "https://hz-t3.matpool.com:29839?token=SVRWq5p7zL"
                    ]
                },
                "port_8895": {
                    "urls": [
                        "https://hz-t3.matpool.com:26171?token=SVRWq5p7zL"
                    ]
                },
                "port_8989": {
                    "urls": [
                        "ssh://hz-4.matpool.com:27083"
                    ]
                }
            },
            "fromSnapshotId": 0,
            "SSHAuths": [
                {
                    "BaseOn": {
                        "Cred": {
                            "id": 1886413,
                            "user": "root",
                            "password": "Xvc73v(RS2T5-qW1"
                        }
                    }
                }
            ],
            "netConfig": null,
            "remark": "job & instance's name",
            "fromImageId": 633839
        },
        "res": {
            "cpus": 0,
            "gpus": 0,
            "diskGB": 0,
            "gpuName": "NVIDIA A16",
            "domain": "all",
            "agentDomain": 0
        },
        "createTime": {
            "seconds": 1744020679
        },
        "vols": null,
        "queueLen": 0,
        "nets": [],
        "displayID": "PVpNM1",
        "autoRelease": false,
        "releaseTime": null,
        "updateTime": null,
        "desc": ""
    }
}
修改于 2025-04-08 08:45:59
上一页
新增任务
下一页
查询所有任务状态
Built with