跳到主要内容

更新模板

更新任务模板,包括Codepath、Resource、image、ENV等。
PUT
https://api.alayanew.com/api/serverless-train/v1/template/{id}
Authorizations
AuthorizationsStringHeaderRequired

用户可通过已获取Serverless API Key做验证,例如:plain Credential=[YOUR_AK],Signature=[YOUR_SK]。

Path Parameters
idStringRequired

模板ID。

Body
application/json
nameStringRequired

模板名称,例如:my-debug。

vksIdStringRequired

VKS ID,例如:vc3jedd7crnd。

namespaceStringRequired

VKS namespace,例如:default。

labelsObject

任务运行的标签。

replicasIntRequired

任务副本数(debug,run,shell为1,task,group为1-100),默认值 1,例如:1。

workDirStringRequired

代码的工作目录,例如:/root/。

cmdArray[String]Required

执行命令。

argsArray[String]

执行命令的参数。

envObject

资源。

resourceObjectRequired

imageStringRequired

镜像名称。

imagePullSecretObject

pvcMountsArray[Object]

extensionsObject

扩展字段。

Response
状态码:application/json
codeInt

code是一种常见的返回值形式,表示查询操作的执行结果。

0是成功标识,表示操作成功完成。
dataObject

msgString

code返回值为-1时,返回异常信息。

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"
    }
  }'
  
{
    "code": 0,
    "data": {
        "id": "5df0ef3c-252a-44c8-aba3-a87e23615c76"
    }
}