更新模板
更新任务模板,包括Codepath、Resource、image、ENV等。
PUT
https://api.alayanew.com/api/serverless-train/v1/template/{id}
Authorizations
Authorizations:StringHeaderRequired
用户可通过已获取Serverless API Key做验证,例如:plain Credential=[YOUR_AK],Signature=[YOUR_SK]。
Path Parameters
id:StringRequired
模板ID。
Body
application/json
name:StringRequired
模板名称,例如:my-debug。
vksId:StringRequired
VKS ID,例如:vc3jedd7crnd。
namespace:StringRequired
VKS namespace,例如:default。
labels:Object
任务运行的标签。
replicas:IntRequired
任务副本数(debug,run,shell为1,task,group为1-100),默认值 1,例如:1。
workDir:StringRequired
代码的工作目录,例如:/root/。
cmd:Array[String]Required
执行命令。
args:Array[String]
执行命令的参数。
env:Object
资源。
resource:ObjectRequired
image:StringRequired
镜像名称。
imagePullSecret:Object
pvcMounts:Array[Object]
extensions:Object
扩展字段。
Response
状态码:application/json
200
code:Int
code是一种常见的返回值形式,表示查询操作的执行结果。
0
-1
0是成功标识,表示操作成功完成。
data:Object
msg:String
code返回值为-1时,返回异常信息。
cURL
Python
JavaScript
Go
Java
curl -X PUT 'https://api.alayanew.com/api/serverless-train/v1/template/5df0ef3c-252a-44c8-aba3-a87e23615c76'
-H 'Authorization: plain Credential=YOUR_AK,Signature=YOUR_SK'
-H 'Content-Type: application/json'
-d '{
"name": "my-debug-updated",
"vksId": "vc3jedd7crnd",
"namespace": "default",
"replicas": 1,
"workDir": "/root/",
"cmd": ["bash", "-c", "python3 main.py"],
"resource": {
"cpu": 4,
"mem": 16,
"gpu": {
"count": 2,
"gpuType": "nvidia.com/gpu-tesla-p4"
},
"epheneralStorage": 48
},
"image": "registry.hd-01.alayanew.com/aladdin/python:3.13",
"pvcMounts": [
{
"pvcName": "pvc-capacity-userdata",
"subPath": "b",
"containerPath": "/b",
"readOnly": true
}
],
"extensions": {
"tag": "4",
"tenantId": "dc8e48eb-4c05-4466-8ee2-2c3f969352bf"
}
}'
200
400
401
404
429
503
504
{
"code": 0,
"data": {
"id": "5df0ef3c-252a-44c8-aba3-a87e23615c76"
}
}