UpdateJobTemplate - 更新任务模板

更新时间:
复制为 MD 格式

更新任务模板。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

PUT /api/v1/jobtemplates/{TemplateId} HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

TemplateId

string

任务模板的唯一标识

tplmceolmf2****

请求参数

名称

类型

必填

描述

示例值

body

object

请求 Body 参数。

TemplateName

string

任务模板的名称

job-template-example-1778047****

Description

string

任务模板的描述信息

Template description

Metadata

object

用户自定义的键值对元数据

{}

Content

string

任务模板的配置内容,支持 CreateJob 接口的所有参数字段,以 JSON 格式传入。提供时会创建新版本。

{\"WorkspaceId\":\"15****05\",\"JobType\":\"PyTorchJob\",\"UserCommand\":\"echo hello\",\"JobSpecs\":[{\"Type\":\"Worker\",\"PodCount\":1,\"Image\":\"dsw-registry-vpc.cn-hangzhou.cr.aliyuncs.com/pai/pytorch:2.8.0-gpu-py313-cu129-ubuntu22.04-3995b779-1764361782\",\"EcsSpec\":\"ecs.gn7i-c8g1.2xlarge\"}],\"ResourceType\":\"ECS\",\"_ResourcePaymentType\":\"PostPaid\",\"CredentialConfig\":{\"EnableCredentialInject\":false},\"Accessibility\":\"PRIVATE\",\"Settings\":{\"JobReservedMinutes\":0,\"Tags\":{}}}

Constraints

object

字段约束规则。Key 为 JSONPath 表达式,Value 为约束类型:locked(锁定不可覆盖)、overridable(可覆盖)、required(必填)。需与 Content 同时提供,不允许单独更新。

{\"JobSpecs[0].Image\":\"locked\",\"UserCommand\":\"locked\",\"JobType\":\"locked\"}

SetAsDefault

boolean

当创建了新版本时,是否将新版本设为默认版本。

true

version

integer

无效字段

无效字段

返回参数

名称

类型

描述

示例值

object

Version

integer

版本号

2

VersionCreated

boolean

是否创建了新版本

true

DefaultVersion

integer

当前使用的默认版本号

2

GmtModifyTime

string

模板的最后修改时间

2021-01-12T14:36:00Z

RequestId

string

本次请求的 ID,用于诊断和答疑。

473469C7-AA6F-4DC5-B3DB-xxxxxxx

示例

正常返回示例

JSON格式

{
  "Version": 2,
  "VersionCreated": true,
  "DefaultVersion": 2,
  "GmtModifyTime": "2021-01-12T14:36:00Z",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-xxxxxxx"
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情