九章智算云
取消排队

取消一个排队中的训练任务。同步完成:仅 Queued 状态可调用,调用成功后任务回到 NotStarted(未启动),再次启动需重新排队。对已处于 NotStarted 的任务调用为幂等成功。任务 ID 可从任务列表获取。

POSThttps://api.alayanew.com/api/osm/v1/training/instance/{id}/cancel-queue

鉴权(Authorizations)

AuthorizationString必填

用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。

Path Parameters

idString必填

训练任务 ID(来自任务列表的 id)。例如:a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58。

Response

statusInteger

业务状态码,200 表示取消排队成功;失败时为错误码。

messageString

响应信息,成功为 "OK";失败时为错误描述。

curl -X 'POST' \
  'https://api.alayanew.com/api/osm/v1/training/instance/a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58/cancel-queue' \
  -H 'accept: application/json' \
  -H 'Authorization: [your-auth-header]'
import requests

task_id = "a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58"
url = f"https://api.alayanew.com/api/osm/v1/training/instance/{task_id}/cancel-queue"
headers = {
    "accept": "application/json",
    "Authorization": "[your-auth-header]"
}

response = requests.post(url, headers=headers)
print(response.json())
const taskId = 'a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58';

fetch(`https://api.alayanew.com/api/osm/v1/training/instance/${taskId}/cancel-queue`, {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': '[your-auth-header]'
  }
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);
{
  "status": 200,
  "message": "OK"
}

最后更新于