CreateJobTemplate - 创建作业模板

更新时间:
复制 MD 格式

创建作业模版

调试

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

调试

授权信息

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

请求参数

名称

类型

必填

描述

示例值

JobTemplateName

string

模板名称。

my-template

JobTemplateDescription

string

模板描述。

Demo

JobTemplateConfig

object

模板配置。

DeploymentPolicy

object

资源部署策略。

AllocationSpec

string

资源类型。

Dedicated

Level

string

算力等级,仅在资源类型为经济型时有效。General:通用型;Performance:性能型。

General

Network

object

网络配置信息。

EnableExternalIpAddress

boolean

作业是否创建公网 IP。默认值:false

false

Vswitch

array

交换机数组。

vsw-xxxx

string

交换机 ID。

vsw-xxx

Pool

string

作业资源池。

my-pool

Priority

integer

作业优先级。取值越大,作业调度优先级越高。

1

Tags

array<object>

作业标签信息。

object

Key

string

作业标签键。

TestKey

Value

string

作业标签值。

TestValue

JobDescription

string

作业描述。

Demo

JobName

string

作业名称。

test-job

JobScheduler

string

作业调度器类型。

HPC

SecurityPolicy

object

安全策略。

SecurityGroup

object

安全组。

SecurityGroupIds

array

安全组 ID 数组。

sg-xxxx

string

安全组 ID。

sg-xxx

Tasks

array<object>

任务列表,最多 5 个任务。

array<object>

ExecutorPolicy

object

任务执行策略。

ArraySpec

object

数组作业详情。

IndexEnd

integer

数组作业索引的结束值。取值范围:0~4999,且大于等于 IndexStart。

9

IndexStart

integer

数组作业索引的起始值。取值范围:0~4999。

0

IndexStep

integer

数组作业索引的间隔。

1

MaxCount

integer

作业运行最大节点数。

1

TaskName

string

任务名称。

task0

TaskSpec

object

任务规格详情。

Resource

object

运行环境资源信息。

Cores

number

运行环境的 CPU 个数。

2

Disks

array<object>

云盘数组。

object

Size

integer

云盘大小。单位为 GiB。

40

Type

string

云盘类型。

System

EnableHT

boolean

运行环境是否开启超线程。

true

HostNamePrefix

string

运行环境主机名前缀。

compute

InstanceTypes

array

运行环境的实例规格。

ecs.c7a.8xlarge

string

运行环境的实例规格。

ecs.c7.2xlarge

Memory

number

运行环境的内存大小。单位为 GiB。

4

RetryPolicy

object

任务重试策略。

ExitCodeActions

array<object>

重试规则。

object

Action

string

任务下一步行为。Retry:重试;Exit:退出。

Retry

ExitCode

integer

任务退出码,配合 Action 组成作业重试规则。取值范围:0~255。

1

RetryCount

integer

重试次数。

5

TaskExecutor

array<object>

任务执行配置。

array<object>

Container

object

使用容器环境。

AppId

string

容器应用 ID。

ci-vm-32k6LXAi3cOG

Arg

array

容器启动命令对应的参数。

60s

string

容器启动命令对应的参数。

60s

Command

array

容器启动命令列表。

sleep

string

容器启动命令内容。每个命令最多包含 256 个字符。

sleep

EnvironmentVars

array<object>

容器的环境变量。

object

Name

string

环境变量名。

PATH

Value

string

环境变量值。

/usr/local/bin

Image

string

容器镜像。

registry-vpc.cn-hangzhou.aliyuncs.com/ehpc/hpl:latest

ImageRegistryOptions

string

自建镜像仓库挂载参数列表。为 KV 形式,采用 JSON 传递。

{}

WorkingDir

string

容器工作目录。

/usr/local/

VM

object

使用虚拟机环境。

AppId

string

虚拟机应用 ID。

ci-vm-9jc58Pm5Leky

Image

string

镜像 ID。

m-xxxx

Password

string

虚拟机环境登录密码。

EHPC@1234

PrologScript

string

前处理脚本。需 Base64 编码。

ZWNobyBoZWxsbyBlY3Mh

Script

string

运行作业脚本。需 Base64 编码。

ZWNobyBoZWxsbyBlY3Mh

VolumeMount

array<object>

任务挂载的数据卷列表。最多 10 组。

object

MountOptions

string

数据卷挂载参数列表。为 KV 形式,采用 JSON 传递。

{"server":"xxxxx-xxxxx.cn-heyuan.nas.aliyuncs.com","vers":"3","path":"/data","options":"nolock,tcp,noresvport"}

MountPath

string

任务挂载数据卷的目录。

/mnt

ReadOnly

boolean

数据卷是否只读。

false

VolumeDriver

string

当前支持的数据卷类型。

alicloud/nas

TaskSustainable

boolean

是否是长时间运行的作业。true:后台服务作业;false:批处理作业。默认值:false

false

返回参数

名称

类型

描述

示例值

object

Schema of Response

JobTemplateId

string

作业模板 ID。

jt-xxxx

RequestId

string

请求 ID。

896D338C-E4F4-41EC-A154-D605E5DE****

示例

正常返回示例

JSON格式

{
  "JobTemplateId": "jt-xxxx",
  "RequestId": "896D338C-E4F4-41EC-A154-D605E5DE****"
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParams The specified parameter %s is invalid. 无效的参数:%s
400 JobTemplateAlreadyExists The job template already exists. 同名的作业模板已存在。
403 DuplicateTagKey Duplicate tag key exists: %s. 存在重复的标签主键。
403 PoolNotFound The specified pool was not found. 资源池不存在
403 PoolStatusInvalid The specified pool in invalid status. 无效资源池状态
403 QuotaExceeded.JobTemplate Insufficient job template quota. 作业模板配额不足。
404 SecurityGroupNotExists The security group does not exist. 安全组不存在
406 AliyunError An Alibaba Cloud product error occurred. 阿里云产品错误. %s
406 DbError A database error occurred. 数据库错误

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

变更历史

更多信息,参考变更详情