暂停训练任务
暂停一个运行中的训练任务。该接口为同步接口,返回成功仅表示暂停请求已受理,实际暂停由系统异步完成;仅 Running 状态的任务可调用。调用成功后,任务先进入 Pausing(暂停中),待系统确认后转为 Suspended(已暂停)。暂停后可通过恢复训练任务继续运行。任务 ID 可从任务列表获取。
POST
https://api.alayanew.com/api/osm/v1/training/instance/{id}/pause鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
idString必填训练任务 ID(来自任务列表的 id)。仅对处于运行中状态的任务有效。例如:a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58。
Response
application/json · 200statusInteger业务状态码,200 表示暂停请求已受理;失败时为错误码。
messageString响应信息,成功为 "OK";失败时为错误描述。
curl -X 'POST' \
'https://api.alayanew.com/api/osm/v1/training/instance/a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58/pause' \
-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}/pause"
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}/pause`, {
method: 'POST',
headers: {
'accept': 'application/json',
'Authorization': '[your-auth-header]'
}
})
.then(res => res.json())
.then(console.log)
.catch(console.error);{
"status": 200,
"message": "OK"
}最后更新于
