重启训练任务
重启或恢复一个训练任务(未启动、已暂停、失败等状态),任务进入 Restarting(重启中),由系统完成后回到 Running。请求体带 skuCode 即为变配启动:仅从未启动过的任务可以变更规格,且 workerCount 必须与 skuCode 同传;不带 skuCode 为纯重启,沿用原规格。任务 ID 可从任务列表获取。
POST
https://api.alayanew.com/api/osm/v1/training/instance/{id}/resume鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
idString必填训练任务 ID(来自任务列表的 id)。例如:a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58。
Request body
application/jsonskuCodeString目标规格 SKU 编码。传入即为变配启动,不传为纯重启(沿用原规格)。
workerCountInteger节点数量。必须与 skuCode 同传,单独传入会被拒绝。
imageTypeString镜像类型。
imageString镜像地址。
storageConfigsArray存储挂载配置。不传表示保持原配置;传则整体替换,且不能为空数组。
显示 properties
storageIdString挂载的存储实例 ID。
mountPathString容器内挂载路径。
priorityInteger任务优先级,取值 1~3。
computeResourceTypeString算力资源类型:ELASTIC / EXCLUSIVE。不传时使用任务当前配置。
exclusiveResourceIdString独占资源 ID,仅算力资源类型为 EXCLUSIVE 时传入。
Response
application/json · 200statusInteger业务状态码,200 表示重启请求已受理;失败时为错误码。
messageString响应信息,成功为 "OK";失败时为错误描述。
纯重启(沿用原规格)
curl -X 'POST' \
'https://api.alayanew.com/api/osm/v1/training/instance/a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58/resume' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: [your-auth-header]' \
-d '{}'变配重启(变更规格与节点数)
curl -X 'POST' \
'https://api.alayanew.com/api/osm/v1/training/instance/a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58/resume' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: [your-auth-header]' \
-d '{
"skuCode": "SKU-HPT-L40S-16C128G",
"workerCount": 4
}'纯重启(沿用原规格)
import requests
task_id = "a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58"
url = f"https://api.alayanew.com/api/osm/v1/training/instance/{task_id}/resume"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "[your-auth-header]"
}
response = requests.post(url, headers=headers, json={})
print(response.json())变配重启(变更规格与节点数)
import requests
task_id = "a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58"
url = f"https://api.alayanew.com/api/osm/v1/training/instance/{task_id}/resume"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "[your-auth-header]"
}
payload = {
"skuCode": "SKU-HPT-L40S-16C128G",
"workerCount": 4
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())纯重启(沿用原规格)
const taskId = 'a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58';
fetch(`https://api.alayanew.com/api/osm/v1/training/instance/${taskId}/resume`, {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': '[your-auth-header]'
},
body: JSON.stringify({})
})
.then(res => res.json())
.then(console.log)
.catch(console.error);变配重启(变更规格与节点数)
const taskId = 'a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58';
fetch(`https://api.alayanew.com/api/osm/v1/training/instance/${taskId}/resume`, {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': '[your-auth-header]'
},
body: JSON.stringify({
skuCode: 'SKU-HPT-L40S-16C128G',
workerCount: 4
})
})
.then(res => res.json())
.then(console.log)
.catch(console.error);{
"status": 200,
"message": "OK"
}最后更新于
